Attribute extensions

The Attr interface retains the original methods:

					String  getName();
					String  getValue();
					void    setValue( String value );
					boolean getSpecified();
				

The only addition is the getOwnerElement method:

Element getOwnerElement();

This method returns a node representing the element that contains the attribute:

Element owner = myAttribute.getOwnerElement();

Note that the Attr interface is not affected by the need to cope with namespaces. The objects that implement the Element and NamedNodeMap interfaces are affected instead, because they are used to access attributes.

Get XML Companion, The, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.