Attr has no methods of its own. See also Element, as attr represents an attribute of a markup element.
Note that the DOM does not place Attr nodes within the hierarchy. They are considered mere properties of the associated Element node - their parentNode, previousSibling and nextSibling are null. An Attr's only possible child node types are Text and EntityReference.
Some random XML markup:
<!DOCTYPE doc PUBLIC "-//funnytoes//DTD docdtd XML V1//EN" "/usr/dtd/doc/doc.dtd">
<docbody docname="first doc" author="funnytoes"/>
<docbody docname="second doc "last""/>
The DOM objects here are:
Contains the name of this attribute.
Introduced in DOM Level 2.
The Element that has this attribute (or null if it's not been set on any element).
True if the user (i.e. the document content) created the Attr (whether or not it's set on any element). False if the implementation created it (i.e. because the DTD says this attribute exists with a particular value on the element on which it's set).
The "plain" textual value of all Text and EntityReference child nodes. Setting this removes any existing child nodes and replaces them with a single Text node containing the value.
Log in or register
to write something here or to contact authors.