gtpx1m0bXML User's Guide

DOM

The DOM specification is an object-based interface developed by the World Wide Web Consortium (W3C) that builds an XML document as a tree structure in memory. An application accesses the XML data through the tree in memory, which is a replication of how the data is actually structured. The DOM also allows you to dynamically traverse and update the XML document.

How Do I Use DOM?

When writing applications using the DOM API, you will use a set of C/C++ APIs to interact with the XML data. The documentation for these functions was included in the XML4C package that was ported to TPF. To view the API documentation, go to XML4C Version 3.5.1 Documentation.

When Should I Use DOM?

The DOM API is ideal when you want to manage XML data or access a complex data structure repeatedly. The DOM API:

Using the DOM API preserves the structure of the document (and the relationship between elements) and does the parsing up front so that you do not have to do the parsing process over again each time you access a piece of data. If you choose to validate your document, you can be assured that the syntax of the data is valid while you are working with it. However, the DOM API requires the memory needed to store the data, which can be expensive in terms of machine cycles. In addition, the DOM API is, by nature, a two-step process:

  1. It parses the entire XML document.
  2. Applications interact with the XML data held in memory using the C/C++ APIs.

As a result, you cannot begin working with the data until the DOM API has completely parsed the entire document.

XML4C parser 3.5.1 supports both DOM level 1.0 and DOM level 2.0. Level 2.0 builds on the APIs in level 1.0, which allow for data manipulation by having additional APIs that allow for items such as namespaces and cascading style sheets (CSSs). IDOM is an experimental API included in this version of the XML4C parser that is a prototyped redesign of the DOM API. For more information about the DOM API at each of these levels, go to XML4C Version 3.5.1 Documentation.

For More Information

For more information, do the following: