|
JDOM 2.0.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jdom2.Content
org.jdom2.ProcessingInstruction
public class ProcessingInstruction
An XML processing instruction. 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 or, if the data appears akin to an attribute list, can be retrieved as name/value pairs.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.jdom2.Content |
---|
Content.CType |
Field Summary | |
---|---|
protected java.util.Map<java.lang.String,java.lang.String> |
mapData
The data for the PI in name/value pairs |
protected java.lang.String |
rawData
The data for the PI as a String |
protected java.lang.String |
target
The target of the PI |
Fields inherited from class org.jdom2.Content |
---|
ctype, parent |
Constructor Summary | |
---|---|
protected |
ProcessingInstruction()
Default, no-args constructor for implementations to use if needed. |
|
ProcessingInstruction(java.lang.String target)
This will create a new ProcessingInstruction
with the specified target. |
|
ProcessingInstruction(java.lang.String target,
java.util.Map<java.lang.String,java.lang.String> 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 | |
---|---|
ProcessingInstruction |
clone()
Return a deep clone of this instance. |
ProcessingInstruction |
detach()
Detaches this child from its parent or does nothing if the child has no parent. |
java.lang.String |
getData()
This will return the raw data from all instructions. |
java.util.List<java.lang.String> |
getPseudoAttributeNames()
This will return a List containing the names of the
"attribute" style pieces of name/value pairs in this PI's data. |
java.lang.String |
getPseudoAttributeValue(java.lang.String name)
This will return the value for a specific name/value pair on the PI. |
java.lang.String |
getTarget()
This will retrieve the target of the PI. |
java.lang.String |
getValue()
Returns the XPath 1.0 string value of this element, which is the data of this PI. |
boolean |
removePseudoAttribute(java.lang.String name)
This will remove the pseudo attribute with the specified name. |
ProcessingInstruction |
setData(java.util.Map<java.lang.String,java.lang.String> 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 |
setParent(Parent parent)
Sets the parent of this Content. |
ProcessingInstruction |
setPseudoAttribute(java.lang.String name,
java.lang.String value)
This will set a pseudo attribute with the given name and value. |
ProcessingInstruction |
setTarget(java.lang.String newTarget)
This will set the target for the PI. |
java.lang.String |
toString()
This returns a String representation of the
ProcessingInstruction , suitable for debugging. |
Methods inherited from class org.jdom2.Content |
---|
equals, getCType, getDocument, getNamespacesInherited, getNamespacesInScope, getNamespacesIntroduced, getParent, getParentElement, hashCode |
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 transient java.util.Map<java.lang.String,java.lang.String> mapData
Constructor Detail |
---|
protected ProcessingInstruction()
public ProcessingInstruction(java.lang.String target)
ProcessingInstruction
with the specified target.
target
- String
target of PI.
IllegalTargetException
- if the given target is illegal
as a processing instruction name.public ProcessingInstruction(java.lang.String target, java.util.Map<java.lang.String,java.lang.String> data)
ProcessingInstruction
with the specified target and data.
target
- String
target of PI.data
- Map
data for PI, in
name/value pairs
IllegalTargetException
- if the given target is illegal
as a processing instruction name.public ProcessingInstruction(java.lang.String target, java.lang.String data)
ProcessingInstruction
with the specified target and data.
target
- String
target of PI.data
- String
data for PI.
IllegalTargetException
- if the given target is illegal
as a processing instruction name.Method Detail |
---|
public ProcessingInstruction setTarget(java.lang.String newTarget)
newTarget
- String
new target of PI.
ProcessingInstruction
- this PI modified.public java.lang.String getValue()
getValue
in class Content
public java.lang.String getTarget()
String
- target of PI.public java.lang.String getData()
String
- data of PI.public java.util.List<java.lang.String> getPseudoAttributeNames()
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)
data
- String
data of PI.
ProcessingInstruction
- this PI modified.public ProcessingInstruction setData(java.util.Map<java.lang.String,java.lang.String> data)
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.
data
- new map data to use
ProcessingInstruction
- modified PI.public java.lang.String getPseudoAttributeValue(java.lang.String name)
name
- String
name of name/value pair
to lookup value for.
String
- value of name/value pair.public ProcessingInstruction setPseudoAttribute(java.lang.String name, java.lang.String value)
name
- String
name of pair.value
- String
value for pair.
ProcessingInstruction
this PI modified.public boolean removePseudoAttribute(java.lang.String name)
name
- name of pseudo attribute to remove
boolean
- whether the requested
instruction was removed.public java.lang.String toString()
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 ProcessingInstruction clone()
All JDOM core classes are Cloneable, and never throw CloneNotSupportedException. Additionally all Cloneable JDOM classes return the correct type of instance from this method and there is no need to cast the result (co-variant return vaue).
Subclasses of this should still call super.clone() in their clone method.
clone
in class Content
public ProcessingInstruction detach()
Content
This method can be overridden by particular Content subclasses to return
a specific type of Content (co-variant return type). All overriding
subclasses must call super.detach()
;
detach
in class Content
protected ProcessingInstruction setParent(Parent parent)
Content
This method can be overridden by particular Content subclasses to return
a specific type of Content (co-variant return type). All overriding
subclasses must call super.setParent(Parent)
;
setParent
in class Content
parent
- new parent element
|
JDOM 2.0.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |