Name
nodeValue: DOMString
Synopsis
Intended to provide a reasonable string value for
the underlying DOM object. Depending on the nodeType
, this property may be
read-only, read/write, or null
.
This table lists the values for the object types.
Object type | nodeValue |
| null |
| Attribute value |
| Text node content |
| CDATA section content |
| null |
| null |
| Entire content, excluding the target |
| Comment content |
| null |
| null |
| null |
| null |
Exceptions
- NO_MODIFICATION_ALLOWED_ERR
Indicates the
nodeValue
attribute is read-only for this DOM object type.- DOMSTRING_SIZE_ERR
This exception is raised if the value that would be returned is too large to be contained by a
DOMString
type in the given implementation.
Java bindings
public String getNodeValue( ) throws DOMException; public void setNodeValue(String nodeValue) throws DOMException;
Java example
// If this node is a text node, make the value lowercase if (nd.getNodeType( ) = = Node.TEXT_NODE) { // make it lowercase nd.setNodeValue(nd.getNodeValue( ).toLowerCase( )); }
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.