Compartilhar via


XML DOM Application Development

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

With DOM, applications can work with XML document structures and information as program structures rather than as text streams. By using the built-in facilities of the DOM API in this implementation, applications and scripts can read and manipulate the program structures without understanding the details of XML syntax.

The following list shows the functionality provided by DOM:

  • Loads or creates a document
  • Performs Document Type Definition (DTD) validation or schema validation
  • Gathers errors
  • Accesses and manipulates the information and structures contained within the document
  • Caches the schema in memory
  • Saves the document back out to an XML file

The DOM uses a tree-like hierarchy of nodes in an XML document. These nodes represent document content and structures and may contain, or are contained by, other nodes. Much of your work with XML processing requires navigating this tree structure to find or modify the information it contains. When you work with XML, you need to think of information in terms of nested containers and be sure that information is put into or retrieved from the right container.

The DOM treats nodes as generic objects. This makes it possible for you to create a script that loads a document and traverses all of the nodes. The script then reports what it finds in the tree.

The DOM APIs enable applications to traverse the tree and manipulate its nodes. Each node is defined as a specific node type, according to the XML DOM Enumerated Constants, which also define valid parent and child nodes for each node type. For the majority of XML documents, the most common node types are element, attribute, and text. Attributes occupy a special place in the model because they are not considered child nodes of a parent and are treated more like properties of elements. An additional API, IXMLDOMNamedNodeMap, is provided for attributes. For information about XML DOM Enumerated Constants, see XML DOM Enumerated Constants.

The XML parser on Windows Mobile is componentized into various XML technologies, which may or may not be included in your Windows® phone, depending on the OS design created by the hardware manufacturer. For a more information about the technologies making up the XML parser, see XML Parser Architecture for Windows Mobile. For a more information about the APIs and XML functionality not supported by XML on Windows Mobile, see XML for Windows Mobile. For more information about XML, see this Microsoft Web site.

In This Section

  • XML for Windows Mobile
    Provides a high level overview of the XML objects and interfaces that are not supported in Windows phones.