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.
| Constructor and Description |
|---|
ProcessingInstruction(ProcessingInstruction instruction)
Create a copy of a processing instruction.
|
ProcessingInstruction(java.lang.String target,
java.lang.String data)
Create a processing instruction with a certain target and data.
|
| Modifier and Type | Method and Description |
|---|---|
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
IndexOutOfBoundsException because
processing instructions do not have children. |
int |
getChildCount()
Returns 0 because processing instructions do not have children.
|
java.lang.String |
getTarget()
Returns the processing instruction target.
|
java.lang.String |
getValue()
Returns the processing instruction data.
|
void |
setTarget(java.lang.String target)
Sets the target.
|
void |
setValue(java.lang.String data)
Sets the data.
|
java.lang.String |
toString()
Returns a
String representation
of this processing instruction suitable for
debugging and diagnosis. |
java.lang.String |
toXML()
Returns the actual XML form of this processing instruction,
such as might be copied and pasted from the original document.
|
detach, equals, getBaseURI, getDocument, getParent, hashCode, query, querypublic ProcessingInstruction(java.lang.String target,
java.lang.String data)
Create a processing instruction with a certain target and data.
target - the target of the processing instructiondata - the processing instruction dataIllegalTargetException - if the target is not a
non-colonized name or is the string "xml" in any caseIllegalDataException - if data contains "?>" or any
other illegal characterspublic ProcessingInstruction(ProcessingInstruction instruction)
Create a copy of a processing instruction.
instruction - the processing instruction to copypublic final java.lang.String getTarget()
Returns the processing instruction target.
public void setTarget(java.lang.String target)
Sets the target.
target - the new targetIllegalTargetException - if the proposed target
is not an XML 1.0 non-colonized name or is the string
"xml" in any casepublic void setValue(java.lang.String data)
Sets the data.
data - the data to setIllegalDataException - if data is null
or otherwise not legal XML processing instruction datapublic final java.lang.String getValue()
Returns the processing instruction data.
public final Node getChild(int position)
Throws IndexOutOfBoundsException because
processing instructions do not have children.
getChild in class Nodeposition - the index of the child node to returnjava.lang.IndexOutOfBoundsException - because processing
instructions do not have childrenpublic final int getChildCount()
Returns 0 because processing instructions do not have children.
getChildCount in class Nodepublic final java.lang.String toXML()
Returns the actual XML form of this processing instruction, such as might be copied and pasted from the original document.
public Node copy()
Returns a deep copy of this processing instruction with no parent, that can be added to this document or a different one.
public final java.lang.String toString()
Returns a String representation
of this processing instruction suitable for
debugging and diagnosis. This is not
the XML representation of this processing instruction.
toString in class java.lang.ObjectProcessingInstructionCopyright 2002-2013 Elliotte Rusty Harold
elharo@ibiblio.org