Contains the document type node that specifies the document type definition (DTD) for this document.
var objXMLDOMDocumentType = oXMLDOMDocument.doctype;
The following script example creates an IXMLDOMDocumentType object, and then displays the name property of the object.
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.5.0");
var MyDocType;
xmlDoc.async = false;
xmlDoc.load("books.xml");
if (xmlDoc.parseError.errorCode <> 0) {
var myErr = xmlDoc.parseError;
alert("You have error " + myErr.reason);
} else {
MyDocType = xmlDoc.doctype;
if (MyDocType != null) {
alert(MyDocType.name);
}
}
Set objXMLDOMDocumentType = oXMLDOMDocument.doctype
The following Microsoft® Visual Basic® example creates an IXMLDOMDocumentType object, and then displays the name property of the object.
Dim xmlDoc As New Msxml2.DOMDocument50
Dim MyDocType As IXMLDOMDocumentType
xmlDoc.async = False
xmlDoc.Load ("books.xml")
If (xmlDoc.parseError.errorCode <> 0) Then
Dim myErr
Set myErr = xmlDoc.parseError
MsgBox("You have error " & myErr.reason)
Else
Set MyDocType = xmlDoc.doctype
If Not MyDocType Is Nothing Then
MsgBox MyDocType.Name
End If
End If
HRESULT get_doctype(
IXMLDOMDocumentType **documentType);
NODE_DOCUMENT_TYPE that specifies the DTD. Returns Null for for HTML documents and XML documents without a DTD.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.
To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button
in the upper-left corner of the page.
Applies to: DOMDocument |IXMLDOMDocumentType