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 (3 recent visits)
- AJAX select list issue in IE6 (402 recent visits)
- AJAX requests in web site template (100 recent visits)
- Scary AJAX error (730 recent visits)
- AJAX meeting brief 1 (9 recent visits)
- AJAX for feedback (5 recent visits)
Stats
189 unique visits since August 2008
Recent Referrers (click)
- has invalid characters outside of the script tags
- json not well formed error
- json not well formed error
- has invalid characters outside of the script tags
- how to avoid invalid chracters using ajax
- invalid characters for ajax request
- character & in AJAX
- json "not well-formed"
- +"not well-formed" json
- javascript console not well-formed
- ajax xml "&" character
- firefox json "not well formed"
- firefox json "not well formed"
- firefox document not well formed json
- & character in ajax request
- not wellformed error and ajax
- square character ajax
- firefox json ajax not well formed