The Document object represents the entire XML document and is the primary means
of access to it; it represents the top node of the DOM tree. Since none of the other nodes
can exist outside of a document, it also contains all the factory methods necessary to create
them. Once created, these child Node objects will each
have an ownerDocument attribute associating them with
the parent document.
Microsoft's implementation includes all of the base DOM document methods as well as
additional methods and properties that support XSL and XML transformations. The document is
the only object that can be created, all other objects and interfaces being accessed or
created from within it.
There are two models of the Document: the free-threaded model and the rental threading model. They both behave
exactly the same but differ in that the rental-treaded versions offer better performance because the parser doesn't need
to manage concurrent access among threads.
Using JavaScript the two different models can be created in the following way:
var xml_doc = new ActiveXObject("Microsoft.XMLDOM");
var xml_ftdoc = new ActiveXObject("Microsoft.FreeThreadedXMLDOM");
And with VBScript:
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
Set objFTXMLDoc = new ActiveXObject("Microsoft.FreeThreadedXMLDOM")
Note:
documents or nodes created by one method cannot be combined with those created by the other.
A Document is also a Node object, and so inherits
various properties and methods from it. For details of the values returned by the
nodeName,
nodeType and nodeValue
properties for a Document, see the Node object.
denotes a Microsoft extension to the W3C DOM.
PROPERTIES
async Property
This property determines whether asynchronous downloading of an XML file is permitted. The default is True, meaning
that the load method returns control to the caller before the download is complete.
Syntax: Document.async
= [true | false]
attributes Property
This is a read-only property that returns an
NamedNodeMap for nodes that can have
attributes.
Syntax: Node.attributes
baseName Property
This is a read-only property that returns the base name for a node.
Syntax: Node.baseName
childNodes Property
This is a read-only property containing a node list of all children for those elements that
can have them.
Syntax: Node.childNodes
dataType Property
This is a read-only property that specifies the data type for the node.
Syntax: Node.dataType
definition Property
This property returns the definition of the node in the DTD or schema.
Syntax: Node.definition
doctype Property
This is a read-only property that contains the document type node that specifies the
DTD for the document.
Syntax: Document.doctype
documentElement Property
This property contains the root element for the document.
Syntax: Document.documentElement
firstChild Property
This is a read-only property that returns the first child node of a node. If there is none,
it returns null.
Syntax: Node.firstChild
implementation Property
This is a read-only property that contains the
DOMImplementation object for the
document. (A DOM application can use objects from multiple implementations.)
Syntax: Document.implementation
lastChild Property
This is a read-only property that returns the last child node of a node. If there is none,
it returns null.
Syntax: Node.lastChild
namespaceURI Property
This property is read-only and returns the URI (Universal Resource Indentifier) of the
namespace.
Syntax: Node.namespaceURI