DOM - Document Object Model

by Linda Quinn

Close Window


DOM accesses the structure of an XML document.

Sample Code
This example uses DOM to read from an XML document.
  Dim xmlDoc As New MSXML2.DOMDocument
  Dim ElementName As String
  Dim ElementValue As String
  xmlDoc.Load("c:\XML_Folder\inventory.xml")
  ElementName = xmlDoc.documentElement.firstChild.baseName
  ElementValue = xmlDoc.documentElement.firstChild.text



DOM Elements
PERSON or //PERSON Any element named "PERSON"
/PEOPLE Elements named "BOOK" that are children of the root node.
PERSON/NAME Elements named "NAME" that are children of the element named "PERSON".
/PEOPLE/PERSON Elements named "PEOPLE" that are children of the element named "PEOPLE" which is a child of the root element.
PEOPLE//NAME Elements named "NAME" that have the element "PEOPLE" as an ancestor.
PEOPLE/*/NAME Elements named "NAME" that have the element "PEOPLE" as an grandparent (Parent of its parent).
PERSON[NAME] Elements named "PERSON" that have a child the element named "NAME".


XPATH Nodes

ROOT Node


ELEMENT Nodes


=================================================================
This content was created by Linda Quinn of LQNet.

See http://www.lqnet.com for a great collection of articles on this and other topics.

=================================================================
Copyright © 2006-2008, LQ Systems,Inc. All rights reserved.


====================================================================
Want an expert to help with your project?    LQ Systems, Inc.   Business Solutions
====================================================================