Secondary menu

Main menu

Q & A - Well-Formed XML

Q: In chapter 1, Writing XML, you point out that when nesting XML elements, each must be completely enclosed in another otherwise the XML document will not be considered well-formed. If an XML document is not well-formed, will it still work?

A: First, when saying that an XML document is well-formed, it means that it conforms to the rules of XML syntax. So the answer to your question is no; an XML document that is not well-formed, will not work, and will not be read by an XML parser. Interestingly, while there are similar rules for HTML, browsers are much more forgiving than XML parsers, and will always try to display an HTML file even if it is not well-formed.


Back to the Q & A page

© 2009 - 2021 Kevin Howard Goldberg