XML Parsing
To read and update - create and manipulate - an XML document, you will need an XML parser.
There are two basic types of XML parsers:
- Tree-based parser: This parser transforms an XML document into a tree structure. It analyzes the whole document, and provides access to the tree elements
- Event-based parser: Views an XML document as a series of events. When a specific event occurs, it calls a function to handle it
The DOM parser is an tree-based parser.
Look at the following XML document fraction:
Jani
The XML DOM sees the XML above as a tree structure:
- Level 1: XML Document
- Level 2: Root element:
- Level 3: Text element: "Jani"