The Attr nodes represents attributes of elements in documents. EG: In the <p title="New Stories"> tag, an Attr node may represent title.

An Attr node has a nodeType=2.

An Attr node may have the following kinds of child nodes: Text, EntityReference.

Of the fundamental nodes (Document, DocumentFragment, Element, Attr, Comment, and Text), Attr nodes are not really part of the document tree since they are always associated with an Element node.


  • isId. 'Returns whether this attribute is known to be of type ID (i.e. to contain an identifier for its owner element) or not. When it is and its value is unique, the ownerElement of this attribute can be retrieved using the method Document.getElementById.'. DOM 3+.
  • name. 'Returns the name of this attribute. If Node.localName is different from null, this attribute is a qualified name.'
  • ownerElement. 'The Element node this attribute is attached to or null if this attribute is not in use.'. DOM 2+.
  • schemaTypeInfo. 'The type information associated with this attribute. While the type information contained in this attribute is guarantee to be correct after loading the document or invoking Document.normalizeDocument(), schemaTypeInfo may not be reliable if the node was moved.'. DOM 3+.
  • specified. 'True if this attribute was explicitly given a value in the instance document, false otherwise. If the application changed the value of this attribute node (even if it ends up having the same value as the default value) then it is set to true. The implementation may handle attributes with default values from other schemas similarly but applications should use Document.normalizeDocument() to guarantee this information is up-to-date.'
  • value. 'On retrieval, the value of the attribute is returned as a string. Character and general entity references are replaced with their values. See also the method getAttribute on the Element interface. On setting, this creates a Text node with the unparsed contents of the string, i.e. any characters that an XML processor would recognize as markup are instead treated as literal text. See also the method Element.setAttribute().'.

GeorgeHernandez.comSome rights reserved