Top Description Fields Constructors Methods
org.dom4j.tree

public Class DefaultProcessingInstruction

extends FlyweightProcessingInstruction
Class Inheritance
Known Direct Subclasses
org.dom4j.dom.DOMProcessingInstruction
Imports
org.dom4j.Element, java.util.Map

DefaultProcessingInstruction is the default Processing Instruction implementation. It is a doubly linked node which supports the parent relationship and can be modified in place.

Author
James Strachan
Version
$Revision: 1.13 $

Field Summary

Modifier and TypeField and Description
private Element
parent

The parent of this node

Inherited from org.dom4j.tree.FlyweightProcessingInstruction:
targettextvalues

Constructor Summary

AccessConstructor and Description
public
DefaultProcessingInstruction(String
is the name of the PI
target
,
Map<String, String>
is the Map values for the PI
values
)

This will create a new PI with the given target and values

public
DefaultProcessingInstruction(String
is the name of the PI
target
,
String
is the values for the PI
values
)

This will create a new PI with the given target and values

public
DefaultProcessingInstruction(Element
is the parent element
parent
,
String
is the name of the PI
target
,
String
is the values for the PI
values
)

This will create a new PI with the given target and values

Method Summary

Modifier and TypeMethod and Description
public Element
getParent()

Overrides org.dom4j.tree.AbstractNode.getParent.

Implements org.dom4j.Node.getParent.

getParent returns the parent Element if this node supports the parent relationship or null if it is the root element or does not support the parent relationship.

public boolean
isReadOnly()

Overrides org.dom4j.tree.AbstractNode.isReadOnly.

Implements org.dom4j.Node.isReadOnly.

isReadOnly returns true if this node is read only and cannot be modified.

public void
setParent(Element
is the new parent of this node.
parent
)

Overrides org.dom4j.tree.AbstractNode.setParent.

Implements org.dom4j.Node.setParent.

setParent sets the parent relationship of this node if the parent relationship is supported or does nothing if the parent relationship is not supported.

public void
setTarget(String
DOCUMENT ME!
target
)

Overrides org.dom4j.tree.FlyweightProcessingInstruction.setTarget.

Implements org.dom4j.ProcessingInstruction.setTarget.

This method is the equivalent to the setNamemethod.
public void
setText(String
is the new textual value of this node
text
)

Overrides org.dom4j.tree.AbstractNode.setText.

Implements org.dom4j.Node.setText.

Sets the text data of this node or this method will throw an UnsupportedOperationException if it is read-only.

public void
public void
public boolean
supportsParent()

Overrides org.dom4j.tree.AbstractNode.supportsParent.

Implements org.dom4j.Node.supportsParent.

supportsParent returns true if this node supports the parent relationship.

Inherited from org.dom4j.tree.FlyweightProcessingInstruction:
createXPathResultgetTargetgetTextgetValuegetValues

Field Detail

parentback to summary
private Element parent

The parent of this node

Constructor Detail

DefaultProcessingInstructionback to summary
public DefaultProcessingInstruction(String target, Map<String, String> values)

This will create a new PI with the given target and values

Parameters
target:String

is the name of the PI

values:Map<String, String>

is the Map values for the PI

DefaultProcessingInstructionback to summary
public DefaultProcessingInstruction(String target, String values)

This will create a new PI with the given target and values

Parameters
target:String

is the name of the PI

values:String

is the values for the PI

DefaultProcessingInstructionback to summary
public DefaultProcessingInstruction(Element parent, String target, String values)

This will create a new PI with the given target and values

Parameters
parent:Element

is the parent element

target:String

is the name of the PI

values:String

is the values for the PI

Method Detail

getParentback to summary
public Element getParent()

Overrides org.dom4j.tree.AbstractNode.getParent.

Implements org.dom4j.Node.getParent.

Doc from org.dom4j.Node.getParent.

getParent returns the parent Element if this node supports the parent relationship or null if it is the root element or does not support the parent relationship.

This method is an optional feature and may not be supported for all Node implementations.

Returns:Element

the parent of this node or null if it is the root of the tree or the parent relationship is not supported.

isReadOnlyback to summary
public boolean isReadOnly()

Overrides org.dom4j.tree.AbstractNode.isReadOnly.

Implements org.dom4j.Node.isReadOnly.

Doc from org.dom4j.Node.isReadOnly.

isReadOnly returns true if this node is read only and cannot be modified. Any attempt to modify a read-only Node will result in an UnsupportedOperationException being thrown.

Returns:boolean

true if this Node is read only and cannot be modified otherwise false.

setParentback to summary
public void setParent(Element parent)

Overrides org.dom4j.tree.AbstractNode.setParent.

Implements org.dom4j.Node.setParent.

Doc from org.dom4j.Node.setParent.

setParent sets the parent relationship of this node if the parent relationship is supported or does nothing if the parent relationship is not supported.

This method should only be called from inside an Element implementation method and is not intended for general use.

Parameters
parent:Element

is the new parent of this node.

setTargetback to summary
public void setTarget(String target)

Overrides org.dom4j.tree.FlyweightProcessingInstruction.setTarget.

Implements org.dom4j.ProcessingInstruction.setTarget.

Doc from org.dom4j.ProcessingInstruction.setTarget.

This method is the equivalent to the setNamemethod. It is added for clarity.

Parameters
target:String

DOCUMENT ME!

setTextback to summary
public void setText(String text)

Overrides org.dom4j.tree.AbstractNode.setText.

Implements org.dom4j.Node.setText.

Doc from org.dom4j.Node.setText.

Sets the text data of this node or this method will throw an UnsupportedOperationException if it is read-only.

Parameters
text:String

is the new textual value of this node

setValueback to summary
public void setValue(String name, String value)

Overrides org.dom4j.tree.AbstractProcessingInstruction.setValue.

Implements org.dom4j.ProcessingInstruction.setValue.

setValuesback to summary
public void setValues(Map<String, String> values)

Overrides org.dom4j.tree.AbstractProcessingInstruction.setValues.

Implements org.dom4j.ProcessingInstruction.setValues.

supportsParentback to summary
public boolean supportsParent()

Overrides org.dom4j.tree.AbstractNode.supportsParent.

Implements org.dom4j.Node.supportsParent.

Doc from org.dom4j.Node.supportsParent.

supportsParent returns true if this node supports the parent relationship.

Some XML tree implementations are singly linked and only support downward navigation through children relationships. The default case is that both parent and children relationships are supported though for memory and performance reasons the parent relationship may not be supported.

Returns:boolean

true if this node supports the parent relationship or false it is not supported