Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

doctype Property

Contains the document type node that specifies the document type definition (DTD) for this document.

var objXMLDOMDocumentType = oXMLDOMDocument.doctype;

Example

The following script example creates an IXMLDOMDocumentType object, and then displays the name property of the object.

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
var MyDocType;
xmlDoc.async = false;
xmlDoc.load("books.xml");
if (xmlDoc.parseError.errorCode != 0) {
   var myErr = xmlDoc.parseError;
   WScript.Echo("You have error " + myErr.reason);
} else {
   MyDocType = xmlDoc.doctype;
   if (MyDocType != null) {
      WScript.Echo(MyDocType.name);
   }
}


Set objXMLDOMDocumentType = oXMLDOMDocument.doctype

HRESULT get_doctype(
    IXMLDOMDocumentType **documentType);

Parameters

documentType[out, retval]

For XML, the address of the node of type NODE_DOCUMENT_TYPE that specifies the DTD. Returns Null for for HTML documents and XML documents without a DTD.

C/C++ Return Values

S_OK

The value returned if successful.

S_FALSE

The value returned when there is no document type node.

E_INVALIDARG

The value returned if the documentType parameter is Null.

The property is read-only. For XML, it points to the node of type NODE_DOCUMENT_TYPE that specifies the DTD. It returns Null for HTML documents and XML documents without a DTD.

An XML document can contain a document type declaration before the first element in the document. It starts with the tag <!DOCTYPE> and can specify an external DTD.

Implemented in:

MSXML 3.0, MSXML 6.0

Show:
© 2014 Microsoft