MSXML3.0 Document Object
The Document
object
supports the same functionality as the W3C DOM Document
interface, but also features some
Microsoft convenience extensions. For example, with MSXML3.0, you
can use the validate
method to
validate your document against its DTD:
myDomDocument.validate( )
In addition to validation, support for XSLT transformations is
built into the MSXML3.0 as well as with the transformNode
method:
myDomDocument.transformNode(myXSLTDomDocument)
The transformNode
method
takes another DOM instance as a parameter that contains an XSLT
stylesheet. The transformation is applied against the current
document, and the result is returned to the caller. The following
section is a reference for the different methods and properties of
the Document object.
abort( )
createAttribute(
name
)
Creates an attribute using the
name
supplied as a
parameter.
createCDATASection(
data
)
Creates the character string
data
as a CDATA node and
returns.
createComment(
data
)
Creates and returns a new comment using the supplied
data
as the contents.
createDocumentFragment(
)
Creates and returns a new and empty document fragment.
createElement(
elementName
)
Creates and returns a new element with the supplied name.
createEntityReference(
name
)
Creates and returns a new entity reference object.
createNode(
type, name, namespaceURI
)
Creates and returns a node of the given
type
, using the supplied
name
, within the given namespace
context.
createProcessingInstruction(
target, data
)
Creates and returns a new processing instruction with
the given target
and
data
.
createTextNode(
data
)
Creates and returns a text node with the provided
data
as its characters.
getElementsByTagName(
elementName
)
Returns a NodeList
of
elements matching the given name.
getProperty( )
Returns the SelectionLanguage
, ServerHTTPRequest
, or SelectionNamespace
properties.
load(
url
)
Loads the URL supplied as a parameter. If it is a filename, the parser attempts to load the file; if it is a remote HTTP address, the parser attempts to connect and load the document. The existing contents of the document are discarded.
loadXML(
strXML
)
Creates a document object from a well-formed string of XML. Only UTF-16 and UCS-2 text are accepted. Any existing contents of the document are discarded.
nodeFromID(
id
)
Returns the node from the document using the supplied unique ID value.
save(
objTarget
)
Attempts to save the XML document to the specified location.
setProperty( )
Allows you to specify the value of the SelectionLanguage
, ServerHTTPRequest
, or SelectionNamespace
property.
validate( )
Performs validation against the document based on the declared DTD.
async
This read/write property determines whether synchronous or asynchronous document retrieval is used when downloading.
doctype
This read-only property contains the doctype
associated with the XML
document.
documentElement
This read/write property contains the XML document’s root element.
implementation
This read-only property contains the DOMImplementation
object for the
document instance.
namespaces
This read-only property contains a collection of all of the namespaces used in the document.
ondataavailable
This read/write property represents the event handler that is called when data becomes available.
onreadystatechange
This read/write property represents the event handler
that is called when the readyState
property changes.
ontransformnode
This read/write property is set to the event handler
called when the transformnode
event is fired.
parseError
This read-only property contains the document’s ParseError
object.
preserveWhiteSpace
This read/write property determines whether whitespace is preserved during document parsing.
readyState
This read-only property indicates the current state of the document instance.
resolvedExternals
This read/write property determines whether external definitions are resolved during parsing.
url
This read-only property represents the canonical URL for the most recently loaded XML document.
validateOnParse
This read/write Boolean property indicates whether the parser should validate during its parsing pass.