Invalid characters for AJAX script Jan19 '06
I kept getting an XML "not well formed" error in the Firefox JavaScript console.
Well-formed, I wondered? What do you mean? My XML elements were nested properly, and they all had start and end tags.
Ha. Silly me. I was confusing "well formed" with "valid."
Not all XML documents are the same. In particular, two specific descriptions can be applied to XML documents to describe the content contained within them. XML documents can be well formed, and they can also be valid. Validity implies "well-formed-ness," but not vice versa. That’s because a valid XML document is a more strict form of a well-formed XML document. It’s like saying that a square is a rectangle, but not vice versa.
Excerpt taken from the book, XML and Web Services Unleashed.
My problem? I was forgetting to "escape" certain characters - specifically the ampersand (&).
If you don’t escape the ampersand with an Ascii equivalent, your XML parser will spit up your file, in most unpleasant ways. I typically use & - but you can also use &.
Categories: XML ![]()
Add Feedback (view all)
Leave feedback
matthom
is published and produced by Matt Thommes - an independent publishing enthusiast, mobile blogger, content creator, informative writer, web developer from Chicago.
Never one to conform, Matt intends to promote the effect the web has on our lives, in an effort to intensify, instruct, and clarify all that is happening around us.
Similar Entries
- AJAX/Andy/Matt meeting review (2 recent visits)
- AJAX select list issue in IE6 (362 recent visits)
- AJAX requests in web site template (80 recent visits)
- Scary AJAX error (585 recent visits)
- AJAX meeting brief 1 (5 recent visits)
- AJAX for feedback (3 recent visits)
Stats
149 unique visits since August 2008
Recent Referrers (click)
- valid json not well-formed
- ajax "not well-formed"
- json not well-formed
- ajax & character
- ajax character &
- firefox 3 javascript "not well-formed"
- not well-formed ajax mootools
- ajax escape characters ampercent
- "not well-formed" json xml firefox
- < character AJAX
- firefox "error console" javascript "not well formed"
- ajax invalid charactere
- javascript not well formed ajax
- ajax json firefox not-well-formed
- error console ajax not well-formed
- XmlDocument invalid characters
- not well-formed script after ajax
- ajax json well formed firefox
- ajax escape character