Name
getAttribute: name
Synopsis
Returns the attribute specified by the name
parameter as a DOMString
. See createElementNS: namespaceURI,
qualifiedName(2) for a complete
explanation of how an attribute value is determined. This returns
an empty string if no attribute is set and if no default attribute
value was specified in the DTD.
Java binding
public String getAttribute(String name);
Java example
// Check for the name attribute Element elem = doc.getDocumentElement( ); if (elem.getAttribute("name") = = "") { System.out.println("warning: " + elem.getTagName( ) + " element: no name attribute"); }
Get XML in a Nutshell, 3rd 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.