How M/DB:X Represents an XML DOM

The XML Document Object Model (DOM) breaks down an XML document into a tree of interlinked nodes, with each node representing a piece of information, and the links representing the relationships between them.

The various types of information in an XML document (tags, attributes, text, comments etc) are represented by corresponding NodeTypes.

So M/DB:X represents a DOM as a tree of linked nodes. When an XML document is imported into M/DB:X, it is broken down into this set of nodes and pointers by a process known as parsing. Each node in a parsed DOM has a unique identifier known as the NodeOID. This system-generated NodeOID uniquely identifies each node throughout the entire M/DB:X database. An M/DB:X NodeOID therefore implicitly identifies the DOM to which it belongs. In M/DB:X, an instance of a DOM is known as a Document.

A Document has two unique identifiers: the DocumentName which you assign when you import a document or create a DOM, and the DocumentOID which is assigned by M/DB:X. Most M/DB:X Actions for which the Document must be identified can use either the DocumentName or DocumentOID. Actions which relate to a specified Node do not require the Document to be identified, since NodeOIDs implicitly identify the Document to which they belong.

Each node has an associated NodeType and a set of pointers to its parent, child and sibling nodes. Each node belongs to a Document, which in turn has a unique identifier known as the DocumentOID. At the top of each document is a notional DocumentNode which represents the top of the XML node tree for each document.

If a Node is an Element type (NodeType=1), representing a named tag, then it is also known as an Element Node. M/DB:X Actions that relate to Elements will refer to the ElementOID which is the NodeOID for an Element.

Similarly, if a Node is an Attribute type (NodeType=2), representing an attribute within a tag, then it is also known as an Attribute Node. M/DB:X Actions that relate to Attributes will refer to the AttributeOID which is the NodeOID for an Attribute.

The XML DOM API methods interoperate with these nodes and pointers, allowing you to traverse, explore, modify and transform any XML document. Most of the M/DB:X Actions require one or more NodeOIDs as inputs and return one or more NodeOIDs as outputs. The NodeOIDs have little meaning on their own: they are opaque, otherwise meaningless identifiers, but by feeding them in and out of the DOM API methods, you have complete access to all the information held in an XML document.