2.2.3 [DOM Level 2 - Core] Section 1.2, Fundamental Interfaces

C0003:

The specification states:

 IDL Definition 
 exception DOMException {
   unsigned short   code;
 };
 // ExceptionCode
 const unsigned short      INDEX_SIZE_ERR                 = 1;
 const unsigned short      DOMSTRING_SIZE_ERR             = 2;
 const unsigned short      HIERARCHY_REQUEST_ERR          = 3;
 const unsigned short      WRONG_DOCUMENT_ERR             = 4;
 const unsigned short      INVALID_CHARACTER_ERR          = 5;
 const unsigned short      NO_DATA_ALLOWED_ERR            = 6;
 const unsigned short      NO_MODIFICATION_ALLOWED_ERR    = 7;
 const unsigned short      NOT_FOUND_ERR                  = 8;
 const unsigned short      NOT_SUPPORTED_ERR              = 9;
 const unsigned short      INUSE_ATTRIBUTE_ERR            = 10;
 // Introduced in DOM Level 2:
 const unsigned short      INVALID_STATE_ERR              = 11;
 // Introduced in DOM Level 2:
 const unsigned short      SYNTAX_ERR                     = 12;
 // Introduced in DOM Level 2:
 const unsigned short      INVALID_MODIFICATION_ERR       = 13;
 // Introduced in DOM Level 2:
 const unsigned short      NAMESPACE_ERR                  = 14;
 // Introduced in DOM Level 2:
 const unsigned short      INVALID_ACCESS_ERR             = 15; 

MSXML3 and MSXML6

DOMException is not implemented; instead, HRESULT values are returned. The HRESULT code is very different in terms of error types and meanings. Windows terminology uses all uppercase for HRESULT.

V0001:

The specification states:

 IDL Definition 
 interface DOMImplementation {
   boolean            hasFeature(in DOMString feature, 
                                 in DOMString version);
   // Introduced in DOM Level 2:
   DocumentType       createDocumentType(in DOMString qualifiedName, 
                                         in DOMString publicId, 
                                         in DOMString systemId)
                                         raises(DOMException);
   // Introduced in DOM Level 2:
   Document           createDocument(in DOMString namespaceURI, 
                                     in DOMString qualifiedName, 
                                     in DocumentType doctype)
                                         raises(DOMException);
 };

MSXML3 and MSXML6

The createDocumentType and createDocument methods of the DOMImplementation interface are not supported.

C0004:

The specification states:

 Method
 hasFeature
 Test if the DOM implementation implements a specific feature. 
 Parameters 
 feature of type DOMString
 The name of the feature to test (case-insensitive). The values used by DOM features are defined throughout the DOM Level 2 specifications and listed in the Conformance section. The name must be an XML name. To avoid possible conflicts, as a convention, names referring to features defined outside the DOM specification should be made unique by reversing the name of the Internet domain name of the person (or the organization that the person belongs to) who defines the feature, component by component, and using this as a prefix. For instance, the W3C SVG Working Group defines the feature "org.w3c.dom.svg".
  
 version of type DOMString
 This is the version number of the feature to test. In Level 2, the string can be either "2.0" or "1.0". If the version is not specified, supporting any version of the feature causes the method to return true.
  
 Return Value 
 boolean true if the feature is implemented in the specified version, false otherwise.
  
 No Exceptions

MSXML3

The hasFeature method of the DOMImplementation interface supports only the following parameter values:

  • feature= "XML"

  • version="1.0"

The version parameter cannot be empty. For more information about the "XML" value, see [DOM Level 2 - Core], Conformance.

MSXML6

The hasFeature method of the DOMImplementation interface supports only the feature= "XML" parameter value.

C0005:

The specification defines the Document interface.

MSXML3 and MSXML6

The following additional Document interface attributes are supported:

  • async

  • parseError

  • preserveWhiteSpace

  • readyState

  • resolveExternals

  • url

  • validateOnParse

The following additional Document interface methods are supported:

  • abort

  • createNode

  • load

  • loadXML

  • nodeFromID

  • save

The following Document interface events are supported:

  • ondataavailable

  • onreadystatechange

  • ontransformnode

The following methods are not supported:

  • importNode

  • createElementNS

  • createAttributeNS

  • getElementsByTagNameNS

  • getElementById

The documentElement attribute is read/write, not read-only.

C0006:

The specification states:

 Interface Document
  
 Attribute
  
 documentElement of type Element, readonly 
         This is a convenience attribute that allows direct access to the child node that is the root element of the document. For HTML documents, this is the element with the tagName "HTML". 

MSXML3 and MSXML6

The documentElement attribute of the Document interface is read/write, not read-only.

C0007:

The specification defines the interface node.

MSXML3 and MSXML6

The following clarifications apply:

  • The methods isSupported, hasAttributes, and normalize are not supported.

  • The normalize method is defined in Element.

  • The localName method is not supported, but baseName is supported for similar functionality.

  • Additional attributes are supported:

    • dataType

    • definition

    • nodeTypeString

    • nodeTypedValue

    • parsed

    • specified

    • text

    • xml

  • Additional methods are supported:

    • selectNodes

    • selectSingleNode

    • transformNode

    • transformNodeToObject

  • The nodeType is defined as:

        enum tagDOMNodeType 
        {  
            NODE_INVALID, // = 0
            NODE_ELEMENT, // = 1
            NODE_ATTRIBUTE, // = 2
            NODE_TEXT, // = 3
            NODE_CDATA_SECTION, // = 4
            NODE_ENTITY_REFERENCE, // = 5
            NODE_ENTITY, // = 6
            NODE_PROCESSING_INSTRUCTION, // = 7
            NODE_COMMENT, // = 8
            NODE_DOCUMENT, // = 9
            NODE_DOCUMENT_TYPE, // = 10
            NODE_DOCUMENT_FRAGMENT, // = 11
            NODE_NOTATION // = 12
        } DOMNodeType;
    

The names of node types are defined as NODE_xxx instead of xxx_NODE.

C0008:

The specification states:

 attributes of type NamedNodeMap, readonly
 A NamedNodeMap containing the attributes of this node (if it is an Element) or null otherwise.

MSXML3 and MSXML6

The attributes attribute of the NamedNodeMap interface may return the IXMLDOMNamedNodeMap object for the following constants:

  • NODE_ELEMENT

  • NODE_PROCESSING_INSTRUCTION

  • NODE_DOCUMENT_TYPE

  • NODE_ENTITY

  • NODE_NOTATION

C0009:

The specification states:

 Attribute
  
 localName of type DOMString, readonly, introduced in DOM Level 2 
         Returns the local part of the qualified name of this node.
         For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is always null.

MSXML3  and MSXML6

The baseName attribute of the Node interface is supported and provides the same functionality as localName. However, baseName returns an empty string for nodes other than element and attribute.

C0010:

The specification states:

 Attribute
  
 namespaceURI of type DOMString, readonly, introduced in DOM Level 2 
         The namespace URI of this node, or null if it is unspecified.
         This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace URI given at creation time.
         For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is always null. 
         Note: Per the Namespaces in XML Specification [NamespacesXML1.1] an attribute does not inherit its namespace from the element it is attached to. If an attribute is not explicitly given a namespace, it simply has no namespace.

MSXML3 and MSXML6

The following clarifications apply:

  • The namespaceURI attribute of the Node interface returns an empty string if the namespace URI of the node is not specified.

  • The namespaceURI attribute returns an empty string for nodes other than element and attribute.

V0002:

The specification states:

 Attribute
  
 nodeValue of type DOMString 
         The value of this node, depending on its type; see the table above. When it is defined to be null, setting it has no effect.
  
 Exceptions on setting 
         DOMException NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
  
 Exceptions on retrieval 
         DOMException DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation platform.

MSXML3 and MSXML6

The DOMSTRING_SIZE_ERR exception for the nodeValue attribute of the Node interface is not returned because the only limit of a BSTR value is physical memory.

C0011:

The specification states:

 Attribute
 prefix of type DOMString, introduced in DOM Level 2 
 The namespace prefix of this node, or null if it is unspecified.
 Note that setting this attribute, when permitted, changes the nodeName attribute, which holds the qualified name, as well as the tagName and name attributes of the Element and Attr interfaces, when applicable.
 Note also that changing the prefix of an attribute that is known to have a default value, does not make a new attribute with the default value and the original prefix appear, since the namespaceURI and localName do not change.
 For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is always null.
  
 Exceptions on setting 
         DOMException INVALID_CHARACTER_ERR: Raised if the specified prefix contains an illegal character.
         NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
         NAMESPACE_ERR: Raised if the specified prefix is malformed, if the namespaceURI of this node is null, if the specified prefix is "xml" and the namespaceURI of this node is different from "http://www.w3.org/XML/1998/namespace", if this node is an attribute and the specified prefix is "xmlns" and the namespaceURI of this node is different from "http://www.w3.org/2000/xmlns/", or if this node is an attribute and the qualifiedName of this node is "xmlns" [NamespacesXML1.1].

MSXML3 and MSXML6

The following clarifications apply:

  • The prefix attribute of the Node interface is read-only. Any attempt to set a new value for prefix causes an exception.

  • An empty string is returned if the namespace prefix of the node is not specified, or if the node is not an element or an attribute.

C0012:

The specification states:

 appendChild
 Adds the node newChild to the end of the list of children of this node. If the newChild is already in the tree, it is first removed. 
 Parameters 
 newChild of type Node
 The node to add.
 If it is a DocumentFragment object, the entire contents of the document fragment are moved into the child list of this node
  
 Return Value 
 Node
  The node added.
  
  
 Exceptions 
 DOMException
  HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to append is one of this node's ancestors.
  
 WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
  
 NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

MSXML3 and MSXML6

The appendChild method of the Node interface can accept a newChild node that was created from a different document. A WRONG_DOCUMENT_ERR exception is not thrown in this case.

C0013:

The specification states:

 replaceChild
 Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.
 If newChild is a DocumentFragment object, oldChild is replaced by all of the DocumentFragment children, which are inserted in the same order. If the newChild is already in the tree, it is first removed. 
 Parameters 
 newChild of type Node
 The new node to put in the child list.
  
 oldChild of type Node
 The node being replaced in the list.
  
 Return Value 
 Node
  The node replaced.
  
  
 Exceptions 
 DOMException
  HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to put in is one of this node's ancestors.
  
 WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
  
 NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the parent of the new node is readonly.
  
 NOT_FOUND_ERR: Raised if oldChild is not a child of this node.

MSXML3 and MSXML6

The replaceChild method of the Node interface accepts a newChild node that was created from a different document. A WRONG_DOCUMENT_ERR exception is not thrown in this case.

E0001:

The specification states:

IDL Definition

interface NodeList {

  Node               item(in unsigned long index);

  readonly attribute unsigned long    length;

};

MSXML3 and MSXML6

The NodeList interface has two additional methods, nextNode and reset. The length attribute and index of the item method is of type long instead of unsigned long.

E0002:

The specification defines the NamedNodeMap interface.

MSXML3 and MSXML6

The following NamedNodeMap interface methods are not supported:

  • getNamedItemNS

  • removeNamedItemNS

  • setNamedItemNS

The following additional NamedNodeMap interface methods are supported:

  • getQualifiedItem

  • nextNode

  • removeQualifiedItem

  • reset

The length attribute is of type long instead of unsigned long.

C0014:

The specification states:

 removeNamedItem
 Removes a node specified by name. When this map contains the attributes attached to an element, if the removed attribute is known to have a default value, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable. 
 Parameters 
 name of type DOMString
 The nodeName of the node to remove.
  
 Return Value 
 Node
  The node removed from this map if a node with such a name exists.
  
  
 Exceptions 
 DOMException
  NOT_FOUND_ERR: Raised if there is no node named name in this map.
  
 NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.

MSXML3 and MSXML6

The removeNamedItem method of the NamedNodeMap interface returns null if no node is specified for the name parameter. The NOT_FOUND_ERR exception is never thrown.

C0015:

The specification states:

 setNamedItem
 Adds a node using its nodeName attribute. If a node with that name is already present in this map, it is replaced by the new one.
 As the nodeName attribute is used to derive the name which the node must be stored under, multiple nodes of certain types (those that have a "special" string value) cannot be stored as the names would clash. This is seen as preferable to allowing nodes to be aliased. 
 Parameters 
 arg of type Node
 A node to store in this map. The node will later be accessible using the value of its nodeName attribute.
  
 Return Value 
 Node
  If the new Node replaces an existing node the replaced Node is returned, otherwise null is returned.
  
  
 Exceptions 
 DOMException
  WRONG_DOCUMENT_ERR: Raised if arg was created from a different document than the one that created this map.
  
 NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
  
 INUSE_ATTRIBUTE_ERR: Raised if arg is an Attr that is already an attribute of another Element object. The DOM user must explicitly clone Attr nodes to re-use them in other elements.

MSXML3 and MSXML6

The setNamedItem method of the NamedNodeMap interface has the following behaviors:

  • The method returns the node that was successfully added to the collection, not the previously existing node.

  • The method accepts a node that was created by a different document, so it never throws the WRONG_DOCUMENT_ERR exception.

C0016:

The specification defines the CharacterData interface.

MSXML3 and MSXML6

The length, offset, and count attributes of the CharacterData interface are of type long, instead of unsigned long.

C0017:

The specification states:

 data of type DOMString
 The character data of the node that implements this interface. The DOM implementation may not put arbitrary limits on the amount of data that may be stored in a CharacterData node. However, implementation limits may mean that the entirety of a node's data may not fit into a single DOMString. In such cases, the user may call substringData to retrieve the data in appropriately sized pieces.
  
 Exceptions on setting 
 DOMException
  NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
  
  
 Exceptions on retrieval 
 DOMException
  DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation platform.
  
  
 length of type unsigned long, readonly
 The number of 16-bit units that are available through data and the substringData method below. This may have the value zero, i.e., CharacterData nodes may be empty.

MSXML3 and MSXML6

The data attribute of the CharacterData interface does not return an error code in the same manner as the DOMSTRING_SIZE_ERR because the only limit of a BSTR value is physical memory.

C0018:

The specification states:

 substringData
 Extracts a range of data from the node. 
 Parameters 
 offset of type unsigned long
 Start offset of substring to extract.
  
 count of type unsigned long
 The number of 16-bit units to extract.
  
 Return Value 
 DOMString
  The specified substring. If the sum of offset and count exceeds the length, then all 16-bit units to the end of the data are returned.
  
  
 Exceptions 
 DOMException
  INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of 16-bit units in data, or if the specified count is negative.
  
 DOMSTRING_SIZE_ERR: Raised if the specified range of text does not fit into a DOMString.

MSXML3 and MSXML6

The substringData method of the CharacterData interface does not return an error code in the same manner as the DOMSTRING_SIZE_ERR because the only limit of a BSTR value is physical memory.

C0019:

The specification states:

 IDL Definition 
 interface Attr : Node {
   readonly attribute DOMString        name;
   readonly attribute boolean          specified;
            attribute DOMString        value;
                                         // raises(DOMException) on setting
  
   // Introduced in DOM Level 2:
   readonly attribute Element          ownerElement;
 };

MSXML3 and MSXML6

The following clarifications apply:

  • The ownerElement attribute of the Attr interface is not supported.

  • The type of the value attribute is VARIANT.

  • The type of the specified attribute is VARIANT_BOOL.

C0020:

The specification defines the Element interface.

MSXML3 and MSXML6

The following methods of the Element interface are supported:

  • getAttribute

  • getAttributeNode

  • getElementsByTagName

  • removeAttribute

  • removeAttributeNode

  • setAttribute

  • setAttributeNode

The following methods are not supported:

  • getAttributeNodeNS

  • getAttributeNS

  • getElementsByTagNameNS

  • hasAttribute

  • hasAttributeNS

  • removeAttributeNS

  • setAttributeNodeNS

  • setAttributeNS

The following clarifications apply:

  • The getAttribute method returns a value of type VARIANT.

  • The setAttribute method requires that the value attribute is of type VARIANT.

C0021:

The specification states:

 getAttribute
 Retrieves an attribute value by name. 
 Parameters 
 name of type DOMString
 The name of the attribute to retrieve.
  
 Return Value 
 DOMString
  The Attr value as a string, or the empty string if that attribute does not have a specified or default value.
  
 No Exceptions

MSXML3 and MSXML6

The getAttribute method of the Element interface returns null if the attribute does not have a specified or default value.

C0022:

The specification states:

 setAttributeNode
 Adds a new attribute node. If an attribute with that name (nodeName) is already present in the element, it is replaced by the new one.
 To add a new attribute node with a qualified name and namespace URI, use the setAttributeNodeNS method. 
 Parameters 
 newAttr of type Attr
 The Attr node to add to the attribute list.
  
 Return Value 
 Attr
  If the newAttr attribute replaces an existing attribute, the replaced Attr node is returned, otherwise null is returned.
  
  
 Exceptions 
 DOMException
  WRONG_DOCUMENT_ERR: Raised if newAttr was created from a different document than the one that created the element.
  
 NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
  
 INUSE_ATTRIBUTE_ERR: Raised if newAttr is already an attribute of another Element object. The DOM user must explicitly clone Attr nodes to re-use them in other elements.

MSXML3 and MSXML6

The setAttributeNode method of the Element interface can accept new attribute node newAttr that was created from a different document. A WRONG_DOCUMENT_ERR error is not thrown in such case.

C0023:

The specification states:

 IDL Definition 
 interface Text : CharacterData {
   Text               splitText(in unsigned long offset)
                                         raises(DOMException);
 };

MSXML3 and MSXML6

The offset parameter of the splitText method of the Text interface is of type long.

V0003:

The specification states:

 Method
  
 splitText
         Breaks this node into two nodes at the specified offset, keeping both in the tree as siblings. After being split, this node will contain all the content up to the offset point. A new node of the same type, which contains all the content at and after the offset point, is returned. If the original node had a parent node, the new node is inserted as the next sibling of the original node. When the offset is equal to the length of this node, the new node has no data. 
  
 Parameters 
 offset of type unsigned long 
         The 16-bit unit offset at which to split, starting from 0.
  
 Return Value 
 Text        The new node, of the same type as this node.
  
 Exceptions 
 DOMException
                 INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of 16-bit units in data.
                 NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

MSXML3 and MSXML6

The splitText method of the Text interface returns null when the value of offset parameter is the length of the data.

Show: