Why Parse XML?
As you saw earlier in the book, XML is not HTML. In HTML, the processing agent—that is, the HTML browser—has a built-in knowledge of HTML, and it also probably has a built-in "dekludging" engine that allows it to make sense of the most horrific HTML syntax.
XML isn't SGML, either. In SGML there is always a DTD, so an SGML processing agent can look at the DTD and figure out how an SGML document should be rendered.
Because an XML document is designed to be a standalone document, it must contain all the resources that will allow an XML processing agent to successfully process it. These resources are the elements that make an XML document well-formed. For example, without an end tag, a parser would not be able to tell when it had ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access