Feedback

  • Contents
 

XML Parsers

XML documents are often parsed to ensure that they are valid and well-formed.

  • A well-formed document conforms to the XML specification.

  • A valid XML document conforms to a document structure defined by a schema or DTD (Document Type Definition). Valid documents are well-formed documents that have a DTD or schema applied to them. 

It is important to note the distinction between parsers and browsers. Parsers validate data. Browsers display information. SGML and XML are focused on parsing documents rather than presenting them. Parsing is the computer equivalent of reading a document. A parser is a program that reads in a text file, breaks it down into component parts, and validates the document using rules in a DTD file. Internet Explorer offers a built-in parser that you can use to validate XML files. For details, see Viewing XML in Internet Explorer.

DTD stands for Document Type Definition. DTD's define hierarchy structure and elements that can be used in an XML document. For links to DTD tutorials, see Recommended Web Links.) The role of a parser is to identify portions of a document that are invalid in terms of structure or syntax. XML and SGML parsers ensure that documents are coded correctly.