nu.xom
Class ProcessingInstruction
public class ProcessingInstruction
This class represents an XML processing instruction.
Each processing instruction has two key properties:
- The target, a non-colonized name
- The data, a string which does not contain the two character
sequence
?>
. The syntax of the data
depends completely on the processing instruction.
Other than forbidding ?>
, XML defines
no rules for processing instruction data.
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.
|
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 representation
of this processing instruction suitable for
debugging and diagnosis.
|
String | toXML() -
Returns the actual XML form of this processing instruction,
such as might be copied and pasted from the original document.
|
copy , detach , equals , getBaseURI , getChild , getChildCount , getDocument , getParent , getValue , hashCode , query , query , toXML |
ProcessingInstruction
public ProcessingInstruction(String target,
String data)
Create a processing instruction with a certain target and data.
target
- the target of the processing instructiondata
- the processing instruction data
ProcessingInstruction
public ProcessingInstruction(ProcessingInstruction instruction)
Create a copy of a processing instruction.
instruction
- the processing instruction to copy
copy
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.
- copy in interface Node
- a copy of this
ProcessingInstruction
with no parent
getChild
public final Node getChild(int position)
Throws IndexOutOfBoundsException
because
processing instructions do not have children.
- getChild in interface Node
position
- the index of the child node to return
- never returns because processing instructions do not
have children; always throws an exception.
getChildCount
public final int getChildCount()
Returns 0 because processing instructions do not have children.
- getChildCount in interface Node
getTarget
public final String getTarget()
Returns the processing instruction target.
getValue
public final String getValue()
Returns the processing instruction data.
- getValue in interface Node
- the data of the processing instruction
setTarget
public void setTarget(String target)
Sets the target.
setValue
public void setValue(String data)
Sets the data.
toString
public final 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.
- a non-XML string representation of this
ProcessingInstruction
toXML
public final String toXML()
Returns the actual XML form of this processing instruction,
such as might be copied and pasted from the original document.
- toXML in interface Node
- an XML representation of this processing instruction
as a
String
Copyright 2002-2005 Elliotte Rusty Harold
elharo@metalab.unc.edu