XML DOM | Attribute Object

XML DOM - Attribute Object


Hello folks! welcome back to a new section of our tutorial on XML DOM. In this tutorial, we are going to be studying about the XML DOM Attribute Object.

The Attribute Object represents an attribute in an Element Object. The allowable values for attributes are usually difined in a DTD.

Because the Attribute object is also a Node, it inherits the Node object's properties and methods. However Attribute objects are not regarded as part of the document tree since they are not child nodes of the element they describe, and will return null for many of the Node properties.

XML DOM Attribute Object Attributes

The following table lists the attributes of the XML DOM Attribute Object -

AttributeTypeDescription
nameDOMStringThis gives the name of the attribute.
specifiedbooleanIt is a boolean value which returns true if the attribute value exists in the document.
valueDOMStringReturns the value of the attribute.
ownerElementElementIt gives the node to which attribute is associated or null if attribute is not in use.
isIdbooleanIt returns whether the attribute is known to be of type ID (i.e. to contain an identifier for its owner element) or not.


Alright guys! This is where we are going to be rounding up for this tutorial post. In our next tutorial, we will be studying about XML DOM Attribute Object name Attribute.

Feel free to ask your questions where necessary and we will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.

Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.

Thanks for reading and bye for now.