Top Description Fields Constructors Methods
org.dom4j.tree

public abstract Class AbstractProcessingInstruction

extends AbstractNode
implements ProcessingInstruction
Class Inheritance
All Implemented Interfaces
org.dom4j.ProcessingInstruction, org.dom4j.Node, java.lang.Cloneable
Known Direct Subclasses
org.dom4j.tree.FlyweightProcessingInstruction
Imports
org.dom4j.Element, .ProcessingInstruction, .Visitor, java.io.IOException, .Writer, java.util.HashMap, .Map, .StringTokenizer

AbstractProcessingInstruction is an abstract base class for tree implementors to use for implementation inheritence.

Author
James Strachan
Version
$Revision: 1.17 $

Field Summary

Inherited from org.dom4j.tree.AbstractNode:
NODE_TYPE_NAMES

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
accept(Visitor
is the visitor in the Visitor Pattern
visitor
)

Implements org.dom4j.Node.accept.

accept is the method used in the Visitor Pattern.

public String
asXML()

Implements org.dom4j.Node.asXML.

asXML returns the textual XML representation of this node.

public String
getName()

Overrides org.dom4j.tree.AbstractNode.getName.

Implements org.dom4j.Node.getName.

getName returns the name of this node.

private String
public short
getNodeType()

Overrides org.dom4j.tree.AbstractNode.getNodeType.

Implements org.dom4j.Node.getNodeType.

Returns the code according to the type of node.
public String
getPath(Element
is the parent context from which the relative path should start. If the context is null or the context is not an ancestor of this node then the path will be absolute and start from the document and so begin with the '/' character.
context
)

Implements org.dom4j.Node.getPath.

Returns the relative XPath expression which will return a node set containing the given node such as a/b/@c.
public String
getUniquePath(Element
is the parent context from which the path should start. If the context is null or the context is not an ancestor of this node then the path will start from the document and so begin with the '/' character.
context
)

Implements org.dom4j.Node.getUniquePath.

Returns the relative unique XPath expression from the given context which will return a nodeset of one node which is the current node.

private String
protected Map<String, String>

Returns:

DOCUMENT ME!
parseValues
(String
String PI data to parse
text
)

Parses the raw data of PI as a Map.

public boolean
public void
setName(String
is the new name of this node
name
)

Overrides org.dom4j.tree.AbstractNode.setName.

Implements org.dom4j.Node.setName.

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

public void
public void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
protected String

Returns:

DOCUMENT ME!
toString
(Map<String, String>
is a Map of PI data to convert
values
)

This will convert the Map to a string representation.

public void
write(Writer
is the Writer to output the XML to
writer
)

Overrides org.dom4j.tree.AbstractNode.write.

Implements org.dom4j.Node.write.

write writes this node as the default XML notation for this node.

Inherited from org.dom4j.tree.AbstractNode:
asXPathResultclonecreatePatterncreateXPathcreateXPathFiltercreateXPathResultdetachgetDocumentgetDocumentFactorygetNodeTypeNamegetParentgetPathgetStringValuegetTextgetUniquePathhasContentisReadOnlymatchesnumberValueOfselectNodesselectNodesselectNodesselectObjectselectSingleNodesetDocumentsetParentsetTextsupportsParentvalueOf

Constructor Detail

AbstractProcessingInstructionback to summary
public AbstractProcessingInstruction()

Method Detail

acceptback to summary
public void accept(Visitor visitor)

Implements org.dom4j.Node.accept.

Doc from org.dom4j.Node.accept.

accept is the method used in the Visitor Pattern.

Parameters
visitor:Visitor

is the visitor in the Visitor Pattern

asXMLback to summary
public String asXML()

Implements org.dom4j.Node.asXML.

Doc from org.dom4j.Node.asXML.

asXML returns the textual XML representation of this node.

Returns:String

the XML representation of this node

getNameback to summary
public String getName()

Overrides org.dom4j.tree.AbstractNode.getName.

Implements org.dom4j.Node.getName.

Doc from org.dom4j.Node.getName.

getName returns the name of this node. This is the XML local name of the element, attribute, entity or processing instruction. For CDATA and Text nodes this method will return null.

Returns:String

the XML name of this node

getNameback to summary
private String getName(StringTokenizer tokenizer)
getNodeTypeback to summary
public short getNodeType()

Overrides org.dom4j.tree.AbstractNode.getNodeType.

Implements org.dom4j.Node.getNodeType.

Doc from org.dom4j.Node.getNodeType.

Returns the code according to the type of node. This makes processing nodes polymorphically much easier as the switch statement can be used instead of multiple if (instanceof) statements.

Returns:short

a W3C DOM complient code for the node type such as ELEMENT_NODE or ATTRIBUTE_NODE

getPathback to summary
public String getPath(Element context)

Implements org.dom4j.Node.getPath.

Doc from org.dom4j.Node.getPath.

Returns the relative XPath expression which will return a node set containing the given node such as a/b/@c. No indexing will be used to restrict the path if multiple elements with the same name occur on the path.

Parameters
context:Element

is the parent context from which the relative path should start. If the context is null or the context is not an ancestor of this node then the path will be absolute and start from the document and so begin with the '/' character.

Returns:String

the XPath expression relative to the given context which will return a nodeset containing at least this node.

getUniquePathback to summary
public String getUniquePath(Element context)

Implements org.dom4j.Node.getUniquePath.

Doc from org.dom4j.Node.getUniquePath.

Returns the relative unique XPath expression from the given context which will return a nodeset of one node which is the current node. This method will use the XPath index operator to restrict the path if multiple elements with the same name occur on the path.

Parameters
context:Element

is the parent context from which the path should start. If the context is null or the context is not an ancestor of this node then the path will start from the document and so begin with the '/' character.

Returns:String

the XPath expression relative to the given context which will return a nodeset containing just this node.

getValueback to summary
private String getValue(StringTokenizer tokenizer)
parseValuesback to summary
protected Map<String, String> parseValues(String text)

Parses the raw data of PI as a Map.

Parameters
text:String

String PI data to parse

Returns:Map<String, String>

DOCUMENT ME!

removeValueback to summary
public boolean removeValue(String name)

Implements org.dom4j.ProcessingInstruction.removeValue.

setNameback to summary
public void setName(String name)

Overrides org.dom4j.tree.AbstractNode.setName.

Implements org.dom4j.Node.setName.

Doc from org.dom4j.Node.setName.

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

Parameters
name:String

is the new name of this node

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

Implements org.dom4j.ProcessingInstruction.setValue.

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

Implements org.dom4j.ProcessingInstruction.setValues.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

toStringback to summary
protected String toString(Map<String, String> values)

This will convert the Map to a string representation.

Parameters
values:Map<String, String>

is a Map of PI data to convert

Returns:String

DOCUMENT ME!

writeback to summary
public void write(Writer writer) throws IOException

Overrides org.dom4j.tree.AbstractNode.write.

Implements org.dom4j.Node.write.

Doc from org.dom4j.Node.write.

write writes this node as the default XML notation for this node. If you wish to control the XML output (such as for pretty printing, changing the indentation policy etc.) then please use org.dom4j.io.XMLWriter or its derivations.

Parameters
writer:Writer

is the Writer to output the XML to

Exceptions
IOException:
DOCUMENT ME!