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

Feedback

Input format: The editor controls below will assist with Markdown syntax.

Status

Sub-status

Your info

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.

Contact Matt

Similar Entries

Stats

149 unique visits since August 2008

Syndicate

Advertisements