3.2. Parsing XML

A parser is executable processing logic that ensures that a particular document conforms to a specific grammar. Consequently, an XML parser is responsible for ensuring that XML documents conform to the XML grammar. This section examines the details regarding how to parse an XML document.

XML is a specification for a grammar that defines a set of tokens and the sequential ordering of these tokens that allow it to represent data hierarchically. The results of this specification are the following:

  1. Documents have a set of rules to be followed for their creation.

  2. The grammar defines how to build a process to verify that a document has followed the rules of the grammar, and thus is valid.

This is true of any computer language, whether ...

Get Enterprise Application Integration With XML and Java™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.