nu.xom
public class ProcessingInstruction extends Node
This class represents an XML processing instruction. Each processing instruction has two key properties:
?>
. The syntax of the data
depends completely on the processing instruction.
Other than forbidding ?>
, XML defines
no rules for processing instruction data.
Version: 1.0
Constructor Summary | |
---|---|
ProcessingInstruction(String target, String data) Create a processing instruction with a certain target and data. | |
ProcessingInstruction(ProcessingInstruction instruction) Create a copy of a processing instruction. |
Method Summary | |
---|---|
Node | copy() Returns a deep copy of this processing instruction with no parent, that can be added to this document or a different one. |
Node | getChild(int position)
Throws |
int | getChildCount() Returns 0 because processing instructions do not have children. |
String | getTarget() Returns the processing instruction target. |
String | getValue() Returns the processing instruction data. |
void | setTarget(String target) Sets the target. |
void | setValue(String data) Sets the data. |
String | toString()
Returns a |
String | toXML() Returns the actual XML form of this processing instruction, such as might be copied and pasted from the original document. |
Create a processing instruction with a certain target and data.
Parameters: target the target of the processing instruction data the processing instruction data
Throws: IllegalTargetException if the target is not a non-colonized name or is the string "xml" in any case IllegalDataException if data contains "?>" or any other illegal characters
Create a copy of a processing instruction.
Parameters: instruction the processing instruction to copy
Returns a deep copy of this processing instruction with no parent, that can be added to this document or a different one.
Returns: a copy of this ProcessingInstruction
with no parent
Throws IndexOutOfBoundsException
because
processing instructions do not have children.
Parameters: position the index of the child node to return
Returns: never returns because processing instructions do not have children; always throws an exception.
Throws: IndexOutOfBoundsException because processing instructions do not have children
Returns 0 because processing instructions do not have children.
Returns: zero
Returns the processing instruction target.
Returns: the target
Returns the processing instruction data.
Returns: the data of the processing instruction
Sets the target.
Parameters: target the new target
Throws: IllegalTargetException if the proposed target is not an XML 1.0 non-colonized name or is the string "xml" in any case
Sets the data.
Parameters: data the data to set
Throws: IllegalDataException if data
is null
or otherwise not legal XML processing instruction data
Returns a String
representation
of this processing instruction suitable for
debugging and diagnosis. This is not
the XML representation of this processing instruction.
Returns: a non-XML string representation of this
ProcessingInstruction
Returns the actual XML form of this processing instruction, such as might be copied and pasted from the original document.
Returns: an XML representation of this processing instruction
as a String