Class ProcessingInstruction

  • ProcessingInstruction represents an XML ProcessingInstruction node.

  • It includes methods to detach the node, get its raw data, retrieve its parent element, get its target, and get its text value.

  • Thedetach() method removes the node from its parent, returning the detached node.

  • ThegetData() method returns the raw data of the instructions within the node as a string.

  • ThegetParentElement() method returns the parent Element node or null if no parent exists.

  • ThegetTarget() method returns the target of the ProcessingInstruction node as a string.

  • ThegetValue() method returns the combined text value of all direct and indirect child nodes as a string.

ProcessingInstruction

A representation of an XMLProcessingInstruction node.

Methods

MethodReturn typeBrief description
detach()ContentDetaches the node from its parentElement node.
getData()StringGets the raw data for every instruction in theProcessingInstruction node.
getParentElement()ElementGets the node's parentElement node.
getTarget()StringGets the target for theProcessingInstruction node.
getValue()StringGets the text value of all nodes that are direct or indirect children of the node, in the orderthey appear in the document.

Detailed documentation

detach()

Detaches the node from its parentElement node. If the node does not have a parent,this method has no effect.

Return

Content — the detached node


getData()

Gets the raw data for every instruction in theProcessingInstruction node.

Return

String — the raw data for every instruction in theProcessingInstruction node


getParentElement()

Gets the node's parentElement node. If the node does not have a parent, this methodreturnsnull.

Return

Element — the parentElement node


getTarget()

Gets the target for theProcessingInstruction node.

Return

String — the target for theProcessingInstruction node


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.