XML DOM - Attr Object
Attr object
The Attr object represents an attribute of an Element object. The allowable values of an attribute are usually defined in the DTD.
Since an Attr object is also a node, it inherits the properties and methods of the Node object. However, attributes cannot have parent nodes, nor are they considered child nodes of an element, so many Node properties will return null.
Attr Object Properties
| property | Description |
|---|---|
| baseURI | Returns the absolute base URI of the attribute. |
| isId | Returns true if the attribute is of type ID, otherwise returns false. |
| localName | Returns the local part of the attribute's name. |
| name | Returns the name of the attribute. |
| namespaceURI | Returns the namespace URI of the attribute. |
| nodeName | Returns the name of the node, according to its type. |
| nodeType | Returns the type of the node. |
| nodeValue | Sets or returns the value of the node, according to its type. |
| ownerDocument | Returns the root element (document object) to which the attribute belongs. |
| ownerElement | Returns the element node to which the attribute is attached. |
| prefix | Sets or returns the namespace prefix of the attribute. |
| schemaTypeInfo | Returns the type information associated with the attribute. |
| specified | Returns true if the attribute value is set in the document, or false if its default value is set in the DTD/Schema. |
| textContent | Sets or returns the text content of the attribute. |
| value | Sets or returns the value of the attribute. |