public final class Orphan extends java.lang.Object implements MutableNodeInfo
In general this class does not impose constraints defined in the data model: that is the responsibility of the client. For example, the class does not prevent you from creating a comment or text node that has a name or a non-trivial type annotation.
IS_DTD_TYPE, IS_NILLED| Constructor and Description |
|---|
Orphan(Configuration config)
Create an Orphan node
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(NodeName nameCode,
SimpleType attType,
java.lang.CharSequence value,
int properties)
Add an attribute to this element node.
|
void |
addNamespace(NamespaceBinding nscode,
boolean unused)
Add a namespace binding (that is, a namespace node) to this element.
|
AtomicSequence |
atomize()
Get the typed value.
|
int |
compareOrder(NodeInfo other)
Determine the relative position of this node and another node, in document order.
|
void |
delete()
Delete this node (that is, detach it from its parent).
|
boolean |
effectiveBooleanValue()
Get the effective boolean value of this sequence
|
boolean |
equals(NodeInfo other)
Determine whether this is the same node as another node.
|
void |
generateId(FastStringBuffer buffer)
Get a character string that uniquely identifies this node.
|
java.lang.String |
getAttributeValue(java.lang.String uri,
java.lang.String local)
Get the string value of a given attribute of this 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.
|
NamespaceBinding[] |
getDeclaredNamespaces(NamespaceBinding[] buffer)
Get all namespace undeclarations and undeclarations defined on this element.
|
java.lang.String |
getDisplayName()
Get the display name of this node.
|
int |
getFingerprint()
Get fingerprint.
|
java.lang.String |
getLocalPart()
Get the local part of the name of this node.
|
int |
getNodeKind()
Return the kind of node.
|
NodeInfo |
getParent()
Get the NodeInfo object representing the parent of this node
|
java.lang.String |
getPrefix()
Get the prefix of the name of the node.
|
java.lang.String |
getPublicId()
Get the Public ID of the entity containing the node.
|
NodeInfo |
getRoot()
Get the root node of this tree (not necessarily a document node).
|
SchemaType |
getSchemaType()
Get the type annotation of this node, if any.
|
java.lang.String |
getStringValue()
Return the string value of the node.
|
java.lang.CharSequence |
getStringValueCS()
Get the value of the item as a CharSequence.
|
java.lang.String |
getSystemId()
Get the System ID for the node.
|
TreeInfo |
getTreeInfo()
Get information about the tree to which this NodeInfo belongs
|
java.lang.String |
getURI()
Get the URI part of the name of this node.
|
boolean |
hasChildNodes()
Determine whether the node has any children.
|
boolean |
hasFingerprint()
Ask whether this NodeInfo implementation holds a fingerprint identifying the name of the
node in the NamePool.
|
int |
hashCode()
The hashCode() method obeys the contract for hashCode(): that is, if two objects are equal
(represent the same node) then they must have the same hashCode()
|
void |
insertChildren(NodeInfo[] source,
boolean atStart,
boolean inherit)
Insert copies of a sequence of nodes as children of this node.
|
void |
insertSiblings(NodeInfo[] source,
boolean before,
boolean inherit)
Insert copies of a sequence of nodes as siblings of this node.
|
boolean |
isDeleted()
Test whether this MutableNodeInfo object represents a node that has been deleted.
|
boolean |
isDisableOutputEscaping()
Ask whether the node has the disable-output-escaping property
|
boolean |
isId()
Ask whether this node has the is-id property
|
boolean |
isIdref()
Ask whether this node has the is-idref property
|
AxisIterator |
iterateAxis(byte axisNumber)
Return an iteration over the nodes reached by the given axis from this node
|
AxisIterator |
iterateAxis(byte axisNumber,
NodeTest nodeTest)
Return an iteration over the nodes reached by the given axis from this node
|
Builder |
newBuilder()
Get a Builder suitable for building nodes that can be attached to this document.
|
void |
removeAttribute(NodeInfo attribute)
Remove an attribute from this element node
|
void |
removeTypeAnnotation()
Remove type information from this node (and its ancestors, recursively).
|
void |
rename(NodeName newNameCode)
Rename this node.
|
void |
replace(NodeInfo[] replacement,
boolean inherit)
Replace this node with a given sequence of nodes
|
void |
replaceStringValue(java.lang.CharSequence stringValue)
Replace the string-value of this node.
|
Location |
saveLocation()
Get an immutable copy of this Location object.
|
void |
setDisableOutputEscaping(boolean doe)
Set the disable-output-escaping property
|
void |
setIsId(boolean id)
Set the isId property
|
void |
setIsIdref(boolean idref)
Set the isIdref property
|
void |
setNodeKind(short kind)
Set the node kind
|
void |
setNodeName(NodeName nodeName)
Set the name of the node
|
void |
setStringValue(java.lang.CharSequence stringValue)
Set the string value of the node
|
void |
setSystemId(java.lang.String systemId)
Set the system identifier for this Source.
|
void |
setTypeAnnotation(SchemaType typeAnnotation)
Set the type annotation of the node
|
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, waitcopy, equals, getColumnNumber, getConfiguration, getGenre, getLineNumber, isNilled, isSameNodeInfo, isStreamed, toShortStringgetLength, head, itemAt, iterate, iterator, reduce, subsequence, toGroundedValueasIterable, materializemakeRepeatablepublic Orphan(Configuration config)
config - the Saxon configurationpublic TreeInfo getTreeInfo()
getTreeInfo in interface NodeInfopublic java.lang.String getSystemId()
getSystemId in interface javax.xml.transform.SourcegetSystemId in interface javax.xml.transform.SourceLocatorgetSystemId in interface LocationgetSystemId in interface NodeInfogetSystemId in interface org.xml.sax.Locatorpublic java.lang.String getPublicId()
getPublicId in interface javax.xml.transform.SourceLocatorgetPublicId in interface LocationgetPublicId in interface NodeInfogetPublicId in interface org.xml.sax.Locatorpublic void setSystemId(java.lang.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 javax.xml.transform.SourcesystemId - The system identifier as a URL string.public boolean effectiveBooleanValue()
effectiveBooleanValue in interface GroundedValue<NodeInfo>public void setNodeKind(short kind)
kind - the kind of node, for example Type.ELEMENT or Type.ATTRIBUTEpublic void setNodeName(NodeName nodeName)
nodeName - the name of the node. May be null for unnamed nodes such as text and comment nodespublic void setStringValue(java.lang.CharSequence stringValue)
stringValue - the string value of the nodepublic void setTypeAnnotation(SchemaType typeAnnotation)
setTypeAnnotation in interface MutableNodeInfotypeAnnotation - the type annotationpublic void setIsId(boolean id)
id - the isId propertypublic void setIsIdref(boolean idref)
idref - the isIdref propertypublic void setDisableOutputEscaping(boolean doe)
doe - true if the property is to be setpublic int getNodeKind()
getNodeKind in interface NodeInfoTypepublic int getFingerprint()
getFingerprint in interface NodeInfojava.lang.UnsupportedOperationException - if this kind of node does not hold
namepool fingerprints (specifically, if hasFingerprint() returns false).public boolean hasFingerprint()
getFingerprint() method must
return the fingerprint of the node. If the answer is false, then the getFingerprint()
method should throw an UnsupportedOperationException. In the case of unnamed nodes
such as text nodes, the result can be either true (in which case getFingerprint() should
return -1) or false (in which case getFingerprint may throw an exception).hasFingerprint in interface NodeInfoFingerprintedNode as a marker interface.public AtomicSequence atomize() throws XPathException
public SchemaType getSchemaType()
Types derived from a DTD are not reflected in the result of this method.
getSchemaType in interface NodeInfopublic boolean equals(NodeInfo other)
Note: a.equals(b) if and only if generateId(a)==generateId(b)
public int hashCode()
hashCode in interface NodeInfohashCode in class java.lang.Objectpublic java.lang.String getBaseURI()
getBaseURI in interface NodeInfopublic Location saveLocation()
saveLocation in interface Locationpublic int compareOrder(NodeInfo other)
compareOrder in interface NodeInfoother - The other node, whose position is to be compared with this nodepublic java.lang.String getStringValue()
getStringValue in interface GroundedValue<NodeInfo>getStringValue in interface Item<NodeInfo>getStringValue in interface NodeInfoItem.getStringValueCS()public java.lang.CharSequence getStringValueCS()
getStringValueCS in interface GroundedValue<NodeInfo>getStringValueCS in interface Item<NodeInfo>Item.getStringValue()public java.lang.String getLocalPart()
getLocalPart in interface NodeInfopublic java.lang.String getURI()
public java.lang.String getPrefix()
public java.lang.String getDisplayName()
getDisplayName in interface NodeInfopublic NodeInfo getParent()
public AxisIterator iterateAxis(byte axisNumber)
iterateAxis in interface NodeInfoaxisNumber - the axis to be searched, e.g. Axis.CHILD or Axis.ANCESTORAxisInfopublic AxisIterator iterateAxis(byte axisNumber, NodeTest nodeTest)
iterateAxis in interface NodeInfoaxisNumber - the axis to be searched, e.g. Axis.CHILD or Axis.ANCESTORnodeTest - A pattern to be matched by the returned nodesAxisInfopublic java.lang.String getAttributeValue(java.lang.String uri,
java.lang.String local)
getAttributeValue in interface NodeInfouri - the namespace URI of the attribute name. Supply the empty string for an attribute
that is in no namespacelocal - the local part of the attribute name.public NodeInfo getRoot()
public boolean hasChildNodes()
hasChildNodes in interface NodeInfopublic void generateId(FastStringBuffer buffer)
generateId in interface NodeInfobuffer - a buffer, into which will be placed
a string that uniquely identifies this node, within this
document. The calling code prepends information to make the result
unique across all documents.public NamespaceBinding[] getDeclaredNamespaces(NamespaceBinding[] buffer)
getDeclaredNamespaces in interface NodeInfobuffer - If this is non-null, and the result array fits in this buffer, then the result
may overwrite the contents of this array, to avoid the cost of allocating a new array on the heap.For a node other than an element, the method returns null.
public boolean isId()
public boolean isIdref()
public boolean isDisableOutputEscaping()
public void insertChildren(NodeInfo[] source, boolean atStart, boolean inherit)
This method takes no action unless the target node is a document node or element node. It also takes no action in respect of any supplied nodes that are not elements, text nodes, comments, or processing instructions.
The supplied nodes will be copied to form the new children. Adjacent text nodes will be merged, and zero-length text nodes removed.
insertChildren in interface MutableNodeInfosource - the nodes to be insertedatStart - true if the new nodes are to be inserted before existing children; false if they areinherit - true if the insert nodes are to inherit the namespaces of their new parent; false
if such namespaces are to be undeclaredpublic void insertSiblings(NodeInfo[] source, boolean before, boolean inherit)
This method takes no action unless the target node is an element, text node, comment, or processing instruction, and one that has a parent node. It also takes no action in respect of any supplied nodes that are not elements, text nodes, comments, or processing instructions.
The supplied nodes must use the same data model implementation as the tree into which they will be inserted.
insertSiblings in interface MutableNodeInfosource - the nodes to be insertedbefore - true if the new nodes are to be inserted before the target node; false if they areinherit - true if the insert nodes are to inherit the namespaces of their new parent; false
if such namespaces are to be undeclaredpublic void removeAttribute(NodeInfo attribute)
If this node is not an element, or if it has no attribute with the specified name, this method takes no action.
The attribute node itself is not modified in any way.
removeAttribute in interface MutableNodeInfoattribute - the attribute node to be removedpublic void addAttribute(NodeName nameCode, SimpleType attType, java.lang.CharSequence value, int properties)
If this node is not an element, or if the supplied node is not an attribute, the method takes no action. If the element already has an attribute with this name, the existing attribute is replaced.
addAttribute in interface MutableNodeInfonameCode - the name of the new attributeattType - the type annotation of the new attributevalue - the string value of the new attributeproperties - properties including IS_ID and IS_IDREF propertiespublic void delete()
If this node has preceding and following siblings that are both text nodes, the two text nodes will be joined into a single text node (the identity of this node with respect to its predecessors is undefined).
delete in interface MutableNodeInfopublic boolean isDeleted()
isDeleted in interface MutableNodeInfopublic void replace(NodeInfo[] replacement, boolean inherit)
replace in interface MutableNodeInforeplacement - the replacement nodesinherit - true if the replacement nodes are to inherit the namespaces of their new parent; false
if such namespaces are to be undeclaredjava.lang.IllegalArgumentException - if any of the replacement nodes is of the wrong kind. When replacing
a child node, the replacement nodes must all be elements, text, comment, or PI nodes; when replacing
an attribute, the replacement nodes must all be attributes.java.lang.IllegalStateException - if this node is deleted or if it has no parent node.public void replaceStringValue(java.lang.CharSequence stringValue)
replaceStringValue in interface MutableNodeInfostringValue - the new string valuepublic void rename(NodeName newNameCode)
This call has no effect if applied to a nameless node, such as a text node or comment.
If necessary, a new namespace binding will be added to the target element, or to the element parent of the target attribute
rename in interface MutableNodeInfonewNameCode - the namecode of the new name in the name pooljava.lang.IllegalArgumentException - if the new name code is not present in the name pool, or if
it has a (prefix, uri) pair in which the
prefix is the same as that of an existing in-scope namespace binding and the uri is different from that
namespace binding.public void addNamespace(NamespaceBinding nscode, boolean unused)
addNamespace in interface MutableNodeInfonscode - The namespace code representing the (prefix, uri) pair of the namespace binding to be
added. If the target element already has a namespace binding with this (prefix, uri) pair, the call has
no effect. If the target element currently has a namespace binding with this prefix and a different URI, an
exception is raised.unused - java.lang.IllegalArgumentException - if the namespace code is not present in the namepool, or if the target
element already has a namespace binding for this prefixpublic void removeTypeAnnotation()
removeTypeAnnotation in interface MutableNodeInfopublic Builder newBuilder()
newBuilder in interface MutableNodeInfoCopyright (c) 2004-2020 Saxonica Limited. All rights reserved.