All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.jdom.ProcessingInstruction

java.lang.Object
   |
   +----org.jdom.ProcessingInstruction

public class ProcessingInstruction
extends 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:
$Revision: 1.27 $, $Date: 2002/03/20 15:16:32 $
Author:
Brett McLaughlin, Jason Hunter, Steven Gould

Variable Index

 o mapData
The data for the PI in name/value pairs
 o parent
Parent element, document, or null if none
 o rawData
The data for the PI as a String
 o target
The target of the PI

Constructor Index

 o ProcessingInstruction()

Default, no-args constructor for implementations to use if needed.

 o ProcessingInstruction(String, Map)

This will create a new ProcessingInstruction with the specified target and data.

 o ProcessingInstruction(String, String)

This will create a new ProcessingInstruction with the specified target and data.

Method Index

 o clone()

This will return a clone of this ProcessingInstruction.

 o detach()

This detaches the PI from its parent, or does nothing if the PI has no parent.

 o equals(Object)

This tests for equality of this ProcessingInstruction to the supplied Object.

 o getData()

This will return the raw data from all instructions.

 o getDocument()

This retrieves the owning {

 o getNames()

This will return a List containing the names of the "attribute" style pieces of name/value pairs in this PI's data.

 o getParent()

This will return the parent of this ProcessingInstruction.

 o getTarget()

This will retrieve the target of the PI.

 o getValue(String)

This will return the value for a specific name/value pair on the PI.

 o hashCode()

This returns the hash code for this ProcessingInstruction.

 o removeValue(String)

This will remove the name/value pair with the specified name.

 o setData(Map)

This will set the name/value pairs within the passed Map as the pairs for the data of this PI.

 o setData(String)

This will set the raw data for the PI.

 o setDocument(Document)

This sets the {

 o setParent(Element)

This will set the parent of this ProcessingInstruction.

 o setValue(String, String)

This will set the value for the specified name/value pair.

 o toString()

This returns a String representation of the ProcessingInstruction, suitable for debugging.

Variables

 o target
 protected String target
The target of the PI

 o rawData
 protected String rawData
The data for the PI as a String

 o mapData
 protected Map mapData
The data for the PI in name/value pairs

 o parent
 protected Object parent
Parent element, document, or null if none

Constructors

 o ProcessingInstruction
 protected ProcessingInstruction()

Default, no-args constructor for implementations to use if needed.

 o ProcessingInstruction
 public ProcessingInstruction(String target,
                              Map data)

This will create a new ProcessingInstruction with the specified target and data.

Parameters:
target - String target of PI.
data - Map data for PI, in name/value pairs
Throws: IllegalTargetException
if the given target is illegal as a processing instruction name.
 o ProcessingInstruction
 public ProcessingInstruction(String target,
                              String data)

This will create a new ProcessingInstruction with the specified target and data.

Parameters:
target - String target of PI.
rawData - String data for PI.
Throws: IllegalTargetException
if the given target is illegal as a processing instruction name.

Methods

 o getParent
 public Element getParent()

This will return the parent of this ProcessingInstruction. If there is no parent, then this returns null.

Returns:
parent of this ProcessingInstruction
 o setParent
 protected ProcessingInstruction setParent(Element parent)

This will set the parent of this ProcessingInstruction.

Parameters:
parent - Element to be new parent.
Returns:
this ProcessingInstruction modified.
 o detach
 public ProcessingInstruction detach()

This detaches the PI from its parent, or does nothing if the PI has no parent.

Returns:
ProcessingInstruction - this ProcessingInstruction modified.
 o getDocument
 public Document getDocument()

This retrieves the owning {@link Document} for this PI, or null if not a currently a member of a {@link Document}.

Returns:
Document owning this PI, or null.
 o setDocument
 protected ProcessingInstruction setDocument(Document document)

This sets the {@link Document} parent of this PI.

Parameters:
document - Document parent
Returns:
this PI modified
 o getTarget
 public String getTarget()

This will retrieve the target of the PI.

Returns:
String - target of PI.
 o getData
 public String getData()

This will return the raw data from all instructions.

Returns:
String - data of PI.
 o 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.

Returns:
List - the List containing the "attribute" names.
 o setData
 public ProcessingInstruction setData(String data)

This will set the raw data for the PI.

Parameters:
rawData - String data of PI.
Returns:
ProcessingInstruction - this PI modified.
 o 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.

Returns:
ProcessingInstruction - modified PI.
 o 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.

Parameters:
name - String name of name/value pair to lookup value for.
Returns:
String - value of name/value pair.
 o 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.

Parameters:
name - String name of pair.
value - String value for pair.
Returns:
ProcessingInstruction this PI modified.
 o removeValue
 public boolean removeValue(String name)

This will remove the name/value pair with the specified name.

Returns:
boolean - whether the requested instruction was removed.
 o toString
 public String toString()

This returns a String representation of the ProcessingInstruction, suitable for debugging. If the XML representation of the ProcessingInstruction is desired, {@link org.jdom.output.XMLOutputter#outputString(ProcessingInstruction)} should be used.

Returns:
String - information about the ProcessingInstruction
Overrides:
toString in class Object
 o equals
 public final boolean equals(Object ob)

This tests for equality of this ProcessingInstruction to the supplied Object.

Parameters:
ob - Object to compare to.
Returns:
boolean - whether the ProcessingInstruction is equal to the supplied Object.
Overrides:
equals in class Object
 o hashCode
 public final int hashCode()

This returns the hash code for this ProcessingInstruction.

Returns:
int - hash code.
Overrides:
hashCode in class Object
 o clone
 public Object clone()

This will return a clone of this ProcessingInstruction.

Returns:
Object - clone of this ProcessingInstruction.
Overrides:
clone in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index