org.jdom
Class ProcessingInstruction
java.lang.Object
org.jdom.ProcessingInstruction
- Cloneable, Serializable
public class ProcessingInstruction
extends java.lang.Object
implements Serializable, Cloneable
ProcessingInstruction
defines behavior for an
XML processing instruction, modeled in Java. Methods
allow the user to obtain the target of the PI as well as its data.
The data can always be accessed as a String, and where appropriate
can be retrieved as name/value pairs.
Version:
- Brett McLaughlin
- Jason Hunter
- Steven Gould
protected Map | mapData - The data for the PI in name/value pairs
|
protected Object | parent - Parent element, document, or null if none
|
protected String | rawData - The data for the PI as a String
|
protected String | target - The target of the PI
|
ProcessingInstruction() -
Default, no-args constructor for implementations
to use if needed.
|
ProcessingInstruction(String target, Map data) -
This will create a new
ProcessingInstruction
with the specified target and data.
|
ProcessingInstruction(String target, String data) -
This will create a new
ProcessingInstruction
with the specified target and data.
|
Object | clone() -
This will return a clone of this
ProcessingInstruction .
|
ProcessingInstruction | detach() -
This detaches the PI from its parent, or does nothing if the
PI has no parent.
|
boolean | equals(Object ob) -
This tests for equality of this
ProcessingInstruction
to the supplied Object .
|
String | getData() -
This will return the raw data from all instructions.
|
Document | getDocument() -
This retrieves the owning
Document for
this PI, or null if not a currently a member of a
Document .
|
List | getNames() -
This will return a
List containing the names of the
"attribute" style pieces of name/value pairs in this PI's data.
|
Element | getParent() -
This will return the parent of this
ProcessingInstruction .
|
String | getTarget() -
This will retrieve the target of the PI.
|
String | getValue(String name) -
This will return the value for a specific
name/value pair on the PI.
|
int | hashCode() -
This returns the hash code for this
ProcessingInstruction .
|
boolean | removeValue(String name) -
This will remove the name/value pair with the specified
name.
|
ProcessingInstruction | setData(Map data) -
This will set the name/value pairs within the passed
Map as the pairs for the data of
this PI.
|
ProcessingInstruction | setData(String data) -
This will set the raw data for the PI.
|
protected ProcessingInstruction | setDocument(Document document) -
This sets the
Document parent of this PI.
|
protected ProcessingInstruction | setParent(Element parent) -
This will set the parent of this
ProcessingInstruction .
|
ProcessingInstruction | setValue(String name, String value) -
This will set the value for the specified name/value
pair.
|
String | toString() -
This returns a
String representation of the
ProcessingInstruction , suitable for debugging.
|
mapData
protected Map mapData
The data for the PI in name/value pairs
parent
protected Object parent
Parent element, document, or null if none
rawData
protected String rawData
The data for the PI as a String
target
protected String target
The target of the PI
ProcessingInstruction
protected ProcessingInstruction()
Default, no-args constructor for implementations
to use if needed.
ProcessingInstruction
public ProcessingInstruction(String target,
Map data)
This will create a new ProcessingInstruction
with the specified target and data.
target
- String
target of PI.data
- Map
data for PI, in
name/value pairs
ProcessingInstruction
public ProcessingInstruction(String target,
String data)
This will create a new ProcessingInstruction
with the specified target and data.
target
- String
target of PI.
clone
public Object clone()
This will return a clone of this ProcessingInstruction
.
Object
- clone of this
ProcessingInstruction
.
detach
public ProcessingInstruction detach()
This detaches the PI from its parent, or does nothing if the
PI has no parent.
ProcessingInstruction
- this
ProcessingInstruction
modified.
equals
public final boolean equals(Object ob)
This tests for equality of this ProcessingInstruction
to the supplied Object
.
ob
- Object
to compare to.
boolean
- whether the
ProcessingInstruction
is equal to the supplied
Object
.
getData
public String getData()
This will return the raw data from all instructions.
String
- data of PI.
getDocument
public Document getDocument()
This retrieves the owning
Document
for
this PI, or null if not a currently a member of a
Document
.
Document
owning this PI, or null.
getNames
public List getNames()
This will return a List
containing the names of the
"attribute" style pieces of name/value pairs in this PI's data.
List
- the List
containing the
"attribute" names.
getParent
public Element getParent()
This will return the parent of this ProcessingInstruction
.
If there is no parent, then this returns null
.
- parent of this
ProcessingInstruction
getTarget
public String getTarget()
This will retrieve the target of the PI.
String
- target of PI.
getValue
public String getValue(String name)
This will return the value for a specific
name/value pair on the PI. If no such pair is
found for this PI, null is returned.
name
- String
name of name/value pair
to lookup value for.
String
- value of name/value pair.
hashCode
public final int hashCode()
This returns the hash code for this ProcessingInstruction
.
int
- hash code.
removeValue
public boolean removeValue(String name)
This will remove the name/value pair with the specified
name.
boolean
- whether the requested
instruction was removed.
setData
public ProcessingInstruction setData(Map data)
This will set the name/value pairs within the passed
Map
as the pairs for the data of
this PI. The keys should be the pair name
and the values should be the pair values.
ProcessingInstruction
- modified PI.
setData
public ProcessingInstruction setData(String data)
This will set the raw data for the PI.
ProcessingInstruction
- this PI modified.
setParent
protected ProcessingInstruction setParent(Element parent)
This will set the parent of this ProcessingInstruction
.
parent
- Element
to be new parent.
- this
ProcessingInstruction
modified.
setValue
public ProcessingInstruction setValue(String name,
String value)
This will set the value for the specified name/value
pair. If no matching pair is found, the supplied
pair is added to the PI data.
name
- String
name of pair.value
- String
value for pair.
ProcessingInstruction
this PI modified.
toString
public String toString()
String
- information about the
ProcessingInstruction
Copyright B) 2002 Jason Hunter, Brett McLaughlin. All Rights Reserved.