Easy Tutorial
❮ Prop Nodemap Length Dom Nodes Info ❯

XML DOM - Attr Object


Attr Object

The Attr object represents an attribute of an Element object. The allowable values for the attribute are typically defined in a DTD.

Since the Attr object is also a node, it inherits the properties and methods of the Node object. However, attributes cannot have parent nodes, and they are not considered child nodes of the element, which will return null for many Node properties.

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 name.
name Returns the name of the attribute.
namespaceURI Returns the namespace URI of the attribute.
nodeName Returns the name of the node, depending on its type.
nodeType Returns the type of the node.
nodeValue Sets or returns the value of the node, depending on 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.
❮ Prop Nodemap Length Dom Nodes Info ❯