In addition to the properties it inherits from the DOMNode interface, the DOMDocumentType interface supports the following properties:.
elementAttribute(strElemName, longIndex) (Extension to DOM) | |
Access | Read-only |
Type | String |
Description |
elementAttribute provides access to an array containing the names of
all the attributes that are declared in the document's DTD for the element
strElemName, in the same order as they appear in the Attribute
Inspector . A name can be accessed by specifying its index longIndex. The array
index starts at 0. The empty string is returned if the index is greater than the array
length. |
Usage | |
JScript | DOMDocumentType_object.elementAttribute(strElemName, longIndex); |
VBScript | DOMDocumentType_object.elementAttribute(strElemName, longIndex) |
Example |
// SoftQuad Script Language JSCRIPT: var docType=ActiveDocument.doctype; Application.Alert(docType.elementAttribute("P",0)); |
elementAttributes(strElemName) | |
Access | Read-only |
Type | Variant |
Description | Does the same as the elementAttribute property, but returns a Variant object that represents the array. |
Usage | |
JScript | DOMDocumentType_object.elementAttributes(strElemName); |
VBScript | DOMDocumentType_object.elementAttributes(strElemName) |
Example |
' SoftQuad Script Language VBScript: typs = ActiveDocument.doctype.elementAttributes("P") MsgBox "Lower bound is " + cstr(LBound(typs)) MsgBox "Upper bound is " + cstr(UBound(typs)) For i = LBound(typs) To UBound(typs) MsgBox typs(i) Next |
elementType(longIndex) (Extension to DOM) | |
Access | Read-only |
Type | String |
Description | elementType provides access to array containing the names of all the elements that are declared in the document's DTD, in alphabetical order. A name can be accessed by specifying its index longIndex. The array index starts at 0. The empty string is returned if the index is greater than the array length. |
Usage | |
JScript | DOMDocumentType_object.elementType(longIndex); |
VBScript | DOMDocumentType_object.elementType(longIndex) |
Example |
// SoftQuad Script Language JSCRIPT: Application.Alert(ActiveDocument.doctype.elementType(0)); |
elementTypes (Extension to DOM) | |
Access | Read-only |
Type | Variant |
Description | Does the same as the elementType property, but returns a Variant object that represents the array. |
Usage | |
JScript | DOMDocumentType_object.elementTypes; |
VBScript | DOMDocumentType_object.elementTypes |
Example |
Here is how to use elementTypes array return value in scripts: ' SoftQuad Script Language VBScript: typs = ActiveDocument.doctype.elementTypes MsgBox "Lower bound is " + cstr(LBound(typs)) MsgBox "Upper bound is " + cstr(UBound(typs)) For i = LBound(typs) To UBound(typs) MsgBox typs(i) Next // SoftQuad Script Language JScript: typs = ActiveDocument.doctype.elementTypes; Application.Alert("Lower bound is " + typs.lbound()); Application.Alert("Upper bound is " + typs.ubound()); for (i = typs.lbound(); i <= typs.ubound(); i++) { Application.Alert(typs.getItem(i)); } |
hasAttribute(strElemName, strAttrName) (Extension to DOM) | |
Access | Read-only |
Type | Boolean |
Description | Returns true if the attribute strAttrName has been declared for the element strElemName. |
Usage | |
JScript | DOMDocumentType_object.hasAttribute(strElemName, strAttrName); |
VBScript | DOMDocumentType_object.hasAttribute(strElemName, strAttrName) |
Example |
// SoftQuad Script Language JSCRIPT: var dt, rootElem; var dt=ActiveDocument.doctype; var rootElem=ActiveDocument.documentElement.nodeName; if (dt.hasAttribute(rootElem,"class")) Application.Alert("Document has CLASS attribute."); |
hasElementType(strElemName) (Extension to DOM) | |
Access | Read-only |
Type | Boolean |
Description | Returns true if the element strElemName has been declared in the DTD. |
Usage | |
JScript | DOMDocumentType_object.hasElementType(strElemName); |
VBScript | DOMDocumentType_object.hasElementType(strElemName) |
Example |
// SoftQuad Script Language JSCRIPT: // Check document's table model // Note: Check lowercase only for brevity var dt=ActiveDocument.doctype; if (dt.hasElementType("tgroup")) Application.Alert("Document uses CALS tables."); else if (dt.hasElementType("td") && dt.hasElementType("th")) Application.Alert("Document uses HTML tables."); else Application.Alert("Document does not use tables."); |
name | |
Access | Read-only |
Type | String |
Description | The document type; that is, the name immediately following the DOCTYPE keyword. |
Usage | |
JScript | DOMDocumentType_object.name; |
VBScript | DOMDocumentType_object.name |
Example |
// SoftQuad Script Language JSCRIPT: Application.Alert(ActiveDocument.doctype.name); |
Copyright © SoftQuad Software Inc. 1999