public class AxiomDocumentWrapper extends AxiomParentNodeWrapper implements DocumentInfo
This class is used not only for a document, but also for the root of a document-less tree fragment.
Modifier and Type | Class and Description |
---|---|
protected static class |
AxiomDocumentWrapper.FollowingSiblingIterator |
protected static class |
AxiomDocumentWrapper.PrecedingSiblingIterator |
AxiomParentNodeWrapper.ChildWrappingIterator, AxiomParentNodeWrapper.DescendantWrappingIterator
Modifier and Type | Field and Description |
---|---|
protected String |
baseURI |
protected Configuration |
config |
protected long |
documentNumber |
node
ALL_NAMESPACES, IS_DTD_TYPE, IS_NILLED, LOCAL_NAMESPACES, NO_NAMESPACES
Constructor and Description |
---|
AxiomDocumentWrapper(org.apache.axiom.om.OMDocument root,
String baseURI,
Configuration config)
Create a Saxon wrapper for an Axiom document node
|
Modifier and Type | Method and Description |
---|---|
int |
compareOrder(NodeInfo other)
Determine the relative position of this node and another node, in
document order.
|
String |
getBaseURI()
Get the Base URI for the node, that is, the URI used for resolving a relative URI contained
in the node.
|
Configuration |
getConfiguration()
Get the configuration previously set using setConfiguration
|
String |
getDisplayName()
Get the display name of this node.
|
long |
getDocumentNumber()
Get the unique document number for this document (the number is unique
for all documents within a NamePool)
|
DocumentInfo |
getDocumentRoot()
Get the root node, if it is a document node.
|
int |
getFingerprint()
Get fingerprint.
|
String |
getLocalPart()
Get the local part of the name of this node.
|
int |
getNameCode()
Get name code.
|
NamePool |
getNamePool()
Get the name pool used for the names in this document
|
int |
getNodeKind()
Get the kind of node.
|
NodeInfo |
getParent()
Get the NodeInfo object representing the parent of this node
|
String |
getPrefix()
Get the prefix of the name of the node.
|
NodeInfo |
getRoot()
Get the root node of the tree containing this node
|
int |
getSiblingPosition()
Get the index position of this node among its siblings (starting from 0)
|
String |
getSystemId()
Get the System ID for the node.
|
int |
getTypeAnnotation()
Get the type annotation of this node, if any.
|
String[] |
getUnparsedEntity(String name)
Get the unparsed entity with a given name
|
Iterator<String> |
getUnparsedEntityNames()
Get the list of unparsed entities defined in this document
|
String |
getURI()
Get the URI part of the name of this node.
|
Object |
getUserData(String key)
Get user data held in the document node.
|
boolean |
isSameNodeInfo(NodeInfo other)
Determine whether this is the same node as another node.
|
boolean |
isTyped()
Ask whether the document contains any nodes whose type annotation is anything other than
UNTYPED
|
protected AxisIterator<NodeInfo> |
iterateAttributes(NodeTest nodeTest)
Return an iterator over the attributes of this element node.
|
protected AxisIterator<NodeInfo> |
iterateSiblings(NodeTest nodeTest,
boolean forwards)
Return an iterator over the siblings of this node.
|
protected static NodeInfo |
makeWrapper(org.apache.axiom.om.OMNode node,
AxiomDocumentWrapper docWrapper,
AxiomParentNodeWrapper parent,
int index)
Factory method to wrap an Axiom node with a wrapper that implements the
Saxon NodeInfo interface.
|
NodeInfo |
selectID(String id,
boolean getParent)
Get the element with a given ID, if any
|
void |
setConfiguration(Configuration config)
Set the configuration, which defines the name pool used for all names in
this document.
|
void |
setSystemId(String systemId)
Set the system identifier for this Source.
|
void |
setUserData(String key,
Object value)
Set user data on the document node.
|
NodeInfo |
wrap(org.apache.axiom.om.OMNode node)
Wrap a node in the Axiom document.
|
NodeInfo |
wrap(org.apache.axiom.om.OMNode node,
AxiomParentNodeWrapper parent,
int index)
Wrap a node whose parent and sibling position are known in the Axiom document.
|
atomize, generateId, getStringValueCS, getUnderlyingNode, hasChildNodes, iterateChildren, iterateDescendants
comparePosition, copy, equals, getAttributeValue, getColumnNumber, getDeclaredNamespaces, getLineNumber, getRealNode, getSchemaType, getStringValue, hashCode, head, isId, isIdref, isNilled, iterate, iterateAxis, iterateAxis
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
atomize, comparePosition, copy, equals, generateId, getAttributeValue, getColumnNumber, getDeclaredNamespaces, getLineNumber, getSchemaType, getStringValue, hasChildNodes, hashCode, isId, isIdref, isNilled, iterateAxis, iterateAxis
getStringValueCS
protected Configuration config
protected String baseURI
protected long documentNumber
public AxiomDocumentWrapper(org.apache.axiom.om.OMDocument root, String baseURI, Configuration config)
root
- The Axiom root nodebaseURI
- The base URI for all the nodes in the treeconfig
- The configuration which defines the name pool used for all
names in this treepublic NodeInfo wrap(org.apache.axiom.om.OMNode node)
node
- The node to be wrapped. This must be a node in the same
document (the system does not check for this).public NodeInfo wrap(org.apache.axiom.om.OMNode node, AxiomParentNodeWrapper parent, int index)
node
- The node to be wrapped. This must be a node in the same
document (the system does not check for this).parent
- the (wrapper of the) parent node; null if unknownindex
- the position of this node among its siblings; -1 if unknownprotected static NodeInfo makeWrapper(org.apache.axiom.om.OMNode node, AxiomDocumentWrapper docWrapper, AxiomParentNodeWrapper parent, int index)
node
- The Axiom node (an element, text, processing-instruction, or comment node)docWrapper
- The wrapper for the Document containing this nodeparent
- The wrapper for the parent of the Axiom node. May be null if not known.index
- The position of this node relative to its siblings. May be -1 if not knownpublic void setConfiguration(Configuration config)
config
- The configuration to be usedpublic Configuration getConfiguration()
getConfiguration
in interface NodeInfo
getConfiguration
in class AbstractNodeWrapper
public NamePool getNamePool()
getNamePool
in interface NodeInfo
getNamePool
in class AbstractNodeWrapper
public boolean isTyped()
isTyped
in interface DocumentInfo
public long getDocumentNumber()
getDocumentNumber
in interface NodeInfo
getDocumentNumber
in class AbstractNodeWrapper
public int getSiblingPosition()
getSiblingPosition
in interface SiblingCountingNode
public int getNameCode()
getNameCode
in interface NodeInfo
getNameCode
in class AbstractNodeWrapper
allocate
public int getNodeKind()
Type.ELEMENT
or Type.ATTRIBUTE
. There are seven kinds of node: documents, elements, attributes,
text, comments, processing-instructions, and namespaces.getNodeKind
in interface NodeInfo
Type
public boolean isSameNodeInfo(NodeInfo other)
isSameNodeInfo
in interface NodeInfo
isSameNodeInfo
in class AbstractNodeWrapper
other
- the node to be compared with this nodepublic String getBaseURI()
getBaseURI
in interface NodeInfo
getBaseURI
in class AbstractNodeWrapper
public String getSystemId()
getSystemId
in interface Source
getSystemId
in interface NodeInfo
getSystemId
in class AbstractNodeWrapper
public void setSystemId(String systemId)
The system identifier is optional if the source does not get its data from a URL, but it may still be useful to provide one. The application can use a system identifier, for example, to resolve relative URIs and to include in error messages and warnings.
setSystemId
in interface Source
setSystemId
in class AbstractNodeWrapper
systemId
- The system identifier as a URL string.public int getFingerprint()
getFingerprint
in interface NodeInfo
getFingerprint
in class AbstractNodeWrapper
public NodeInfo getParent()
public String getLocalPart()
getLocalPart
in interface NodeInfo
public String getPrefix()
public String getURI()
public String getDisplayName()
getDisplayName
in interface NodeInfo
getDisplayName
in class AbstractNodeWrapper
public NodeInfo getRoot()
getRoot
in interface NodeInfo
getRoot
in class AbstractNodeWrapper
protected AxisIterator<NodeInfo> iterateAttributes(NodeTest nodeTest)
AbstractNodeWrapper
iterateAttributes
in class AbstractNodeWrapper
nodeTest
- a test that the returned attributes must satisfyprotected AxisIterator<NodeInfo> iterateSiblings(NodeTest nodeTest, boolean forwards)
AbstractNodeWrapper
iterateSiblings
in class AbstractNodeWrapper
nodeTest
- a test that the returned siblings must satisfyforwards
- true for following siblings, false for preceding siblingspublic DocumentInfo getDocumentRoot()
getDocumentRoot
in interface NodeInfo
public NodeInfo selectID(String id, boolean getParent)
selectID
in interface DocumentInfo
id
- the required ID valuegetParent
- true if the parent of the selected node is required (for element-with-id)public Iterator<String> getUnparsedEntityNames()
getUnparsedEntityNames
in interface DocumentInfo
public String[] getUnparsedEntity(String name)
getUnparsedEntity
in interface DocumentInfo
name
- the name of the entitypublic int getTypeAnnotation()
getTypeAnnotation
in interface NodeInfo
getTypeAnnotation
in class AbstractNodeWrapper
Type
public void setUserData(String key, Object value)
getUserData(java.lang.String)
setUserData
in interface DocumentInfo
key
- A string giving the name of the property to be set. Clients are responsible
for choosing a key that is likely to be unique. Must not be null. Keys used internally
by Saxon are prefixed "saxon:".value
- The value to be set for the property. May be null, which effectively
removes the existing value for the property.public Object getUserData(String key)
setUserData(java.lang.String, java.lang.Object)
getUserData
in interface DocumentInfo
key
- A string giving the name of the property to be retrieved.public int compareOrder(NodeInfo other)
compareOrder
in interface NodeInfo
other
- The other node, whose position is to be compared with this
nodeCopyright (c) 2004-2013 Saxonica Limited. All rights reserved.