Next page Previous page Start of chapter End of chapter

XML parsers

An XML parser is a software that reads the XML document and determines whether it is well-formed. A well-formed document adheres to the XML grammar rules, in particular it obeys to the following rules:

  1. every start-tag must have a matching end-tag;
  2. elements cannot overlap;
  3. there must be exactly one document element;
  4. attribute values must be quoted;
  5. attribute names for the same element must be different.

It is worth noticing that an XML parser cannot accept a malformed document and it is not allowed to try to fix the document. It it required to report the errors.

The simplest way to parse a document is by loading it into a web browser that knows XML. The browser will display the document whenever it is well-formed or it will report the errors otherwise. As an alternative, one can use a standalone XML parser like the xmllint command line tool.

Next page Previous page Start of chapter End of chapter
Caffè XML - Massimo Franceschet