Interface Content Stay organized with collections Save and categorize content based on your preferences.
Page Summary
A generic XML node is represented by this class.
It has implementing classes for various XML node types like Cdata, Comment, DocType, Element, EntityRef, ProcessingInstruction, and Text.
Methods allow casting the node to specific types, detaching it from its parent, getting the parent element, determining its type, and retrieving its text value.
A representation of a generic XML node.
Implementing classes
| Name | Brief description |
|---|---|
Cdata | A representation of an XMLCDATASection node. |
Comment | A representation of an XMLComment node. |
Doc | A representation of an XMLDocument node. |
Element | A representation of an XMLElement node. |
Entity | A representation of an XMLEntity node. |
Processing | A representation of an XMLProcessing node. |
Text | A representation of an XMLText node. |
Methods
| Method | Return type | Brief description |
|---|---|---|
as | Cdata | Casts the node as aCDATASection node for the purposes of autocomplete. |
as | Comment | Casts the node as aComment node for the purposes of autocomplete. |
as | Doc | Casts the node as aDocument node for the purposes of autocomplete. |
as | Element | Casts the node as anElement node for the purposes of autocomplete. |
as | Entity | Casts the node as aEntity node for the purposes of autocomplete. |
as | Processing | Casts the node as aProcessing node for the purposes of autocomplete. |
as | Text | Casts the node as aText node for the purposes of autocomplete. |
detach() | Content | Detaches the node from its parentElement node. |
get | Element | Gets the node's parentElement node. |
get | Content | Gets the node's content type. |
get | String | Gets the text value of all nodes that are direct or indirect children of the node, in the orderthey appear in the document. |
Detailed documentation
asCdata()
Casts the node as aCDATASection node for the purposes of autocomplete. If thenode'sContent is not alreadyCDATA, this method returnsnull.
Return
Cdata — theCDATASection node
asComment()
Casts the node as aComment node for the purposes of autocomplete. If the node'sContent is not alreadyCOMMENT, this method returnsnull.
Return
Comment — theComment node, ornull if the node's content type is notCOMMENT
asDocType()
Casts the node as aDocument node for the purposes of autocomplete. Ifthe node'sContent is not alreadyDOCTYPE, this method returnsnull.
Return
Doc — theDocument node
asElement()
Casts the node as anElement node for the purposes of autocomplete. If the node'sContent is not alreadyELEMENT, this method returnsnull.
Return
Element — theElement node
asEntityRef()
Casts the node as aEntity node for the purposes of autocomplete.If the node'sContent is not alreadyENTITYREF, this method returnsnull.
Return
Entity — theEntity node
asProcessingInstruction()
Casts the node as aProcessing node for the purposes of autocomplete. Ifthe node'sContent is not alreadyPROCESSINGINSTRUCTION, this methodreturnsnull.
Return
Processing — theProcessing node
asText()
Casts the node as aText node for the purposes of autocomplete. If the node'sContent is not alreadyTEXT, this method returnsnull.
Return
Text — theText node
detach()
getParentElement()
getType()
getValue()
Gets the text value of all nodes that are direct or indirect children of the node, in the orderthey appear in the document.
Return
String — the text value of all nodes that are direct or indirect children of the node
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-11 UTC.