|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jdom.ProcessingInstruction
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.
Field Summary | |
protected java.util.Map |
mapData
The data for the PI in name/value pairs |
protected java.lang.Object |
parent
Parent element, document, or null if none |
protected java.lang.String |
rawData
The data for the PI as a String |
protected java.lang.String |
target
The target of the PI |
Constructor Summary | |
protected |
ProcessingInstruction()
Default, no-args constructor for implementations to use if needed. |
|
ProcessingInstruction(java.lang.String target,
java.util.Map data)
This will create a new ProcessingInstruction
with the specified target and data. |
|
ProcessingInstruction(java.lang.String target,
java.lang.String data)
This will create a new ProcessingInstruction
with the specified target and data. |
Method Summary | |
java.lang.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(java.lang.Object ob)
This tests for equality of this ProcessingInstruction
to the supplied Object . |
java.lang.String |
getData()
This will return the raw data from all instructions. |
Document |
getDocument()
This retrieves the owning for
this PI, or null if not a currently a member of a
. |
java.util.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 . |
java.lang.String |
getTarget()
This will retrieve the target of the PI. |
java.lang.String |
getValue(java.lang.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(java.lang.String name)
This will remove the name/value pair with the specified name. |
ProcessingInstruction |
setData(java.util.Map data)
This will set the name/value pairs within the passed Map as the pairs for the data of
this PI. |
ProcessingInstruction |
setData(java.lang.String data)
This will set the raw data for the PI. |
protected ProcessingInstruction |
setDocument(Document document)
This sets the parent of this PI. |
protected ProcessingInstruction |
setParent(Element parent)
This will set the parent of this ProcessingInstruction . |
ProcessingInstruction |
setValue(java.lang.String name,
java.lang.String value)
This will set the value for the specified name/value pair. |
java.lang.String |
toString()
This returns a String representation of the
ProcessingInstruction , suitable for debugging. |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.lang.String target
protected java.lang.String rawData
protected java.util.Map mapData
protected java.lang.Object parent
Constructor Detail |
protected ProcessingInstruction()
Default, no-args constructor for implementations to use if needed.
public ProcessingInstruction(java.lang.String target, java.util.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 pairsIllegalTargetException
- if the given target is illegal
as a processing instruction name.public ProcessingInstruction(java.lang.String target, java.lang.String data)
This will create a new ProcessingInstruction
with the specified target and data.
target
- String
target of PI.rawData
- String
data for PI.IllegalTargetException
- if the given target is illegal
as a processing instruction name.Method Detail |
public Element getParent()
This will return the parent of this ProcessingInstruction
.
If there is no parent, then this returns null
.
ProcessingInstruction
protected ProcessingInstruction setParent(Element parent)
This will set the parent of this ProcessingInstruction
.
parent
- Element
to be new parent.ProcessingInstruction
modified.public ProcessingInstruction detach()
This detaches the PI from its parent, or does nothing if the PI has no parent.
ProcessingInstruction
- this
ProcessingInstruction
modified.public Document getDocument()
This retrieves the owning
for
this PI, or null if not a currently a member of a
Document
.
Document
Document
owning this PI, or null.protected ProcessingInstruction setDocument(Document document)
This sets the
parent of this PI.
Document
document
- Document
parentPI
modifiedpublic java.lang.String getTarget()
This will retrieve the target of the PI.
String
- target of PI.public java.lang.String getData()
This will return the raw data from all instructions.
String
- data of PI.public java.util.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.public ProcessingInstruction setData(java.lang.String data)
This will set the raw data for the PI.
rawData
- String
data of PI.ProcessingInstruction
- this PI modified.public ProcessingInstruction setData(java.util.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.public java.lang.String getValue(java.lang.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.public ProcessingInstruction setValue(java.lang.String name, java.lang.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.public boolean removeValue(java.lang.String name)
This will remove the name/value pair with the specified name.
boolean
- whether the requested
instruction was removed.public java.lang.String toString()
This returns a String
representation of the
ProcessingInstruction
, suitable for debugging. If the XML
representation of the ProcessingInstruction
is desired,
XMLOutputter.outputString(ProcessingInstruction)
should be used.
toString
in class java.lang.Object
String
- information about the
ProcessingInstruction
public final boolean equals(java.lang.Object ob)
This tests for equality of this ProcessingInstruction
to the supplied Object
.
equals
in class java.lang.Object
ob
- Object
to compare to.boolean
- whether the
ProcessingInstruction
is equal to the supplied
Object
.public final int hashCode()
This returns the hash code for this ProcessingInstruction
.
hashCode
in class java.lang.Object
int
- hash code.public java.lang.Object clone()
This will return a clone of this ProcessingInstruction
.
clone
in class java.lang.Object
Object
- clone of this
ProcessingInstruction
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |