Name
nodeName: DOMString
Synopsis
Intended to represent the underlying DOM object’s name. Depending on the object type, this attribute may map to another attribute of the object or a constant string, as listed in this table:
Object type | nodeName |
| Tag name |
| Attribute name |
| “#text” |
| “#cdata-section” |
| Name of entity referenced |
| Entity name |
| Target |
| “#comment” |
| “#document” |
| Document type name |
| “#document-fragment” |
| Notation name |
Java binding
public String getNodeName( ); // Print the document root tag name Node ndDoc = (Node)doc.getDocumentElement( ); System.out.println("Document root element type: " + ndDoc.getNodeName( ));
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.