Package net.sf.saxon.tree.wrapper
Class RebasedNode
- java.lang.Object
-
- net.sf.saxon.tree.wrapper.AbstractVirtualNode
-
- net.sf.saxon.tree.wrapper.RebasedNode
-
- All Implemented Interfaces:
javax.xml.transform.Source
,javax.xml.transform.SourceLocator
,GroundedValue
,Item
,NodeInfo
,Sequence
,Location
,VirtualNode
,WrappingFunction
,org.xml.sax.Locator
public class RebasedNode extends AbstractVirtualNode implements WrappingFunction
A RebasedNode is a view of a node, in a virtual tree that maps the base URI and/or system ID to new values
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.tree.wrapper.AbstractVirtualNode
docWrapper, node, parent
-
Fields inherited from interface net.sf.saxon.om.NodeInfo
IS_DTD_TYPE, IS_NILLED
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RebasedNode()
protected
RebasedNode(NodeInfo node, RebasedNode parent)
This constructor is protected: nodes should be created using the makeWrapper factory method
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareOrder(NodeInfo other)
Determine the relative position of this node and another node, in document order.boolean
equals(java.lang.Object other)
Determine whether this is the same node as another node.java.lang.String
getBaseURI()
Get the Base URI for the node, that is, the URI used for resolving a relative URI contained in the node.NodeInfo
getParent()
Get the NodeInfo object representing the parent of this nodejava.lang.String
getSystemId()
Get the System ID for the node.AxisIterator
iterateAxis(int axisNumber)
Return an iteration over the nodes reached by the given axis from this nodestatic RebasedNode
makeWrapper(NodeInfo node, RebasedDocument docWrapper, RebasedNode parent)
Factory method to wrap a node with a wrapper that implements the Saxon NodeInfo interface.RebasedNode
makeWrapper(NodeInfo node, VirtualNode parent)
Factory method to wrap a node with a VirtualNode-
Methods inherited from class net.sf.saxon.tree.wrapper.AbstractVirtualNode
atomize, generateId, getAllNamespaces, getAttributeValue, getColumnNumber, getDeclaredNamespaces, getDisplayName, getFingerprint, getLineNumber, getLocalPart, getNodeKind, getPrefix, getRealNode, getRoot, getSchemaType, getStringValue, getStringValueCS, getTreeInfo, getUnderlyingNode, getURI, hasChildNodes, hasFingerprint, hashCode, isId, isIdref, isNilled, iterateAxis, saveLocation, setSystemId
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.om.GroundedValue
asIterable, concatenate, containsNode, effectiveBooleanValue, materialize
-
Methods inherited from interface net.sf.saxon.om.Item
getLength, head, itemAt, iterate, reduce, subsequence
-
Methods inherited from interface net.sf.saxon.om.NodeInfo
attributes, children, children, copy, getConfiguration, getGenre, getPublicId, isSameNodeInfo, isStreamed, toShortString
-
Methods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
-
-
-
Constructor Detail
-
RebasedNode
protected RebasedNode()
-
RebasedNode
protected RebasedNode(NodeInfo node, RebasedNode parent)
This constructor is protected: nodes should be created using the makeWrapper factory method- Parameters:
node
- The node to be wrappedparent
- The RebasedNode that wraps the parent of this node
-
-
Method Detail
-
makeWrapper
public static RebasedNode makeWrapper(NodeInfo node, RebasedDocument docWrapper, RebasedNode parent)
Factory method to wrap a node with a wrapper that implements the Saxon NodeInfo interface.- Parameters:
node
- The underlying nodedocWrapper
- The wrapper for the document node (must be supplied)parent
- The wrapper for the parent of the node (null if unknown)- Returns:
- The new wrapper for the supplied node
-
makeWrapper
public RebasedNode makeWrapper(NodeInfo node, VirtualNode parent)
Factory method to wrap a node with a VirtualNode- Specified by:
makeWrapper
in interfaceWrappingFunction
- Parameters:
node
- The underlying nodeparent
- The wrapper for the parent of the node (null if unknown)- Returns:
- The new wrapper for the supplied node
-
getBaseURI
public java.lang.String getBaseURI()
Get the Base URI for the node, that is, the URI used for resolving a relative URI contained in the node.- Specified by:
getBaseURI
in interfaceNodeInfo
- Overrides:
getBaseURI
in classAbstractVirtualNode
- Returns:
- the base URI of the node. This may be null if the base URI is unknown, including the case where the node has no parent.
-
getSystemId
public java.lang.String getSystemId()
Get the System ID for the node.- Specified by:
getSystemId
in interfaceLocation
- Specified by:
getSystemId
in interfaceorg.xml.sax.Locator
- Specified by:
getSystemId
in interfaceNodeInfo
- Specified by:
getSystemId
in interfacejavax.xml.transform.Source
- Specified by:
getSystemId
in interfacejavax.xml.transform.SourceLocator
- Overrides:
getSystemId
in classAbstractVirtualNode
- Returns:
- the System Identifier of the entity in the source document containing the node, or null if not known. Note this is not the same as the base URI: the base URI can be modified by xml:base, but the system ID cannot.
-
equals
public boolean equals(java.lang.Object other)
Determine whether this is the same node as another node.Note: a.isSameNode(b) if and only if generateId(a)==generateId(b)
- Specified by:
equals
in interfaceNodeInfo
- Overrides:
equals
in classAbstractVirtualNode
- Parameters:
other
- the node to be compared with this node- Returns:
- true if this Node object and the supplied Node object represent the same node in the tree.
-
compareOrder
public int compareOrder(NodeInfo other)
Determine the relative position of this node and another node, in document order. The other node will always be in the same document.- Specified by:
compareOrder
in interfaceNodeInfo
- Overrides:
compareOrder
in classAbstractVirtualNode
- Parameters:
other
- The other node, whose position is to be compared with this node- Returns:
- -1 if this node precedes the other node, +1 if it follows the other node, or 0 if they are the same node. (In this case, isSameNode() will always return true, and the two nodes will produce the same result for generateId())
-
getParent
public NodeInfo getParent()
Get the NodeInfo object representing the parent of this node
-
iterateAxis
public AxisIterator iterateAxis(int axisNumber)
Return an iteration over the nodes reached by the given axis from this node- Specified by:
iterateAxis
in interfaceNodeInfo
- Parameters:
axisNumber
- the axis to be used- Returns:
- a SequenceIterator that scans the nodes reached by the axis in turn.
- See Also:
AxisInfo
-
-