public final class DocumentImpl extends ParentNodeImpl implements DocumentInfo, MutableDocumentInfo
A DocumentImpl object may either represent a real document node, or it may represent an imaginary container for a parentless element.
NODE_LETTERALL_NAMESPACES, EMPTY_NAMESPACE_LIST, IS_DTD_TYPE, IS_NILLED, LOCAL_NAMESPACES, NO_NAMESPACESEMPTY_VALUE_ARRAY| Constructor and Description |
|---|
DocumentImpl()
Create a DocumentImpl
|
| Modifier and Type | Method and Description |
|---|---|
void |
copy(Receiver out,
int copyOptions,
int locationId)
Copy this node to a given outputter
|
void |
deIndex(NodeImpl node)
Remove a node from any indexes when it is detached from the tree
|
protected void |
deregisterID(String id)
Remove the entry for a given ID (when nodes are deleted).
|
void |
generateId(FastStringBuffer buffer)
Get a character string that uniquely identifies this node
|
(package private) AxisIterator |
getAllElements(int fingerprint)
Get a list of all elements with a given name fingerprint
|
String |
getBaseURI()
Get the base URI of this root node.
|
(package private) int |
getColumnNumber(int sequence)
Get the column number for an element.
|
Configuration |
getConfiguration()
Get the configuration previously set using setConfiguration
|
ElementImpl |
getDocumentElement()
Get the root (outermost) element.
|
long |
getDocumentNumber()
Get the unique document number
|
DocumentInfo |
getDocumentRoot()
Get the root (document) node
|
int |
getLineNumber()
Get the line number of this root node.
|
(package private) int |
getLineNumber(int sequence)
Get the line number for an element.
|
NamePool |
getNamePool()
Get the name pool used for the names in this document
|
NodeInfo |
getNextSibling()
Get next sibling - always null
|
int |
getNodeKind()
Return the type of node.
|
DocumentImpl |
getPhysicalRoot()
Get the physical root of the tree.
|
NodeInfo |
getPreviousSibling()
Get previous sibling - always null
|
NodeInfo |
getRoot()
Get the root node
|
String |
getSystemId()
Get the system id of this root node
|
(package private) String |
getSystemId(int seq)
Get the system id of an element in the document
|
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
|
Object |
getUserData(String key)
Get user data held in the document node.
|
void |
graftLocationMap(DocumentImpl original)
Copy the system ID and line number map from another document
(used when grafting a simplified stylesheet)
|
boolean |
isImaginary()
Ask whether this is an imaginary document node
|
Builder |
newBuilder()
Get a Builder suitable for building nodes that can be attached to this document.
|
protected void |
registerID(NodeInfo e,
String id)
Register a unique element ID.
|
void |
replaceStringValue(CharSequence stringValue)
Replace the string-value of this node
|
void |
resetIndexes()
This method is called before performing a batch of updates; it allows all cached data that
might be invalidated by such updates to be cleared
|
NodeInfo |
selectID(String id,
boolean getParent)
Get the element with a given ID.
|
void |
setBaseURI(String uri)
Set the base URI of this document node
|
void |
setConfiguration(Configuration config)
Set the Configuration that contains this document
|
(package private) void |
setDocumentElement(ElementImpl e)
Set the top-level element of the document (variously called the root element or the
document element).
|
void |
setImaginary(boolean imaginary)
Set whether this is an imaginary document node
|
(package private) void |
setLineAndColumn(int sequence,
int line,
int column)
Set the line number for an element.
|
void |
setLineNumbering()
Set line numbering on
|
(package private) void |
setSystemId(int seq,
String uri)
Set the system id of an element in the document
|
void |
setSystemId(String uri)
Set the system id (base URI) of this node
|
(package private) void |
setUnparsedEntity(String name,
String uri,
String publicId)
Set an unparsed entity URI associated with this document.
|
void |
setUserData(String key,
Object value)
Set user data on the document node.
|
addChild, compact, enumerateChildren, getFirstChild, getLastChild, getNthChild, getNumberOfChildren, getRawSequenceNumber, getSequenceNumber, getStringValue, getStringValueCS, hasChildNodes, insertChildren, insertChildrenAt, removeChild, replaceChildrenAt, setChildren, setRawSequenceNumberaddAttribute, addNamespace, atomize, compareOrder, delete, equals, getAttributeValue, getColumnNumber, getDeclaredNamespaces, getDisplayName, getFingerprint, getLocalPart, getNameCode, getNextInDocument, getParent, getPrefix, getPreviousInDocument, getPublicId, getRawParent, getSiblingPosition, getTypedValue, getURI, insertSiblings, isDeleted, isId, isIdref, isNilled, isSameNodeInfo, iterateAxis, iterateAxis, removeAttribute, removeTypeAnnotation, rename, replace, setRawParent, setSiblingPosition, setTypeAnnotationclone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitatomize, compareOrder, equals, getAttributeValue, getColumnNumber, getDeclaredNamespaces, getDisplayName, getFingerprint, getLocalPart, getNameCode, getParent, getPrefix, getStringValue, getURI, hasChildNodes, hashCode, isId, isIdref, isNilled, isSameNodeInfo, iterateAxis, iterateAxisgetStringValueCS, getTypedValuepublic void setConfiguration(Configuration config)
config - the Saxon configurationpublic Configuration getConfiguration()
getConfiguration in interface NodeInfogetConfiguration in class NodeImplpublic NamePool getNamePool()
getNamePool in interface NodeInfogetNamePool in class NodeImplpublic Builder newBuilder()
newBuilder in interface MutableNodeInfonewBuilder in class NodeImplpublic void setImaginary(boolean imaginary)
imaginary - if true, this is an imaginary node - the tree is really rooted at the topmost elementpublic boolean isImaginary()
public long getDocumentNumber()
getDocumentNumber in interface NodeInfogetDocumentNumber in class NodeImplvoid setDocumentElement(ElementImpl e)
e - the top-level elementpublic void graftLocationMap(DocumentImpl original)
original - the document whose system ID and line number maps are to be grafted
onto this treepublic void setSystemId(String uri)
setSystemId in interface SourcesetSystemId in class NodeImplpublic String getSystemId()
getSystemId in interface SourcegetSystemId in interface SourceLocatorgetSystemId in interface NodeInfogetSystemId in class NodeImplpublic void setBaseURI(String uri)
uri - the new base URIpublic String getBaseURI()
getBaseURI in interface NodeInfogetBaseURI in class NodeImplvoid setSystemId(int seq,
String uri)
seq - the sequence number of the elementuri - the system identifier (base URI) of the elementString getSystemId(int seq)
seq - the sequence number of the elementpublic void setLineNumbering()
void setLineAndColumn(int sequence,
int line,
int column)
sequence - the sequence number of the elementline - the line number of the elementcolumn - the column number of the elementint getLineNumber(int sequence)
sequence - the sequence number of the elementint getColumnNumber(int sequence)
sequence - the sequence number of the elementpublic int getLineNumber()
getLineNumber in interface SourceLocatorgetLineNumber in interface NodeInfogetLineNumber in class NodeImplpublic final int getNodeKind()
getNodeKind in interface NodeInfoTypepublic final NodeInfo getNextSibling()
getNextSibling in class NodeImplpublic final NodeInfo getPreviousSibling()
getPreviousSibling in class NodeImplpublic ElementImpl getDocumentElement()
public NodeInfo getRoot()
public DocumentInfo getDocumentRoot()
getDocumentRoot in interface NodeInfogetDocumentRoot in class NodeImplpublic DocumentImpl getPhysicalRoot()
getPhysicalRoot in class NodeImplpublic void generateId(FastStringBuffer buffer)
generateId in interface NodeInfogenerateId in class NodeImplbuffer - a buffer into which will be placed a string based on the document numberAxisIterator getAllElements(int fingerprint)
fingerprint - the fingerprint of the required element namepublic void deIndex(NodeImpl node)
node - the node to be removed from all indexesprotected void registerID(NodeInfo e, String id)
e - The Element having a particular unique ID valueid - The unique ID valuepublic NodeInfo selectID(String id, boolean getParent)
selectID in interface DocumentInfoid - The unique ID of the required element, previously registered using registerID()getParent - protected void deregisterID(String id)
id - The id valuevoid setUnparsedEntity(String name, String uri, String publicId)
name - the entity nameuri - the system identifier of the unparsed entitypublicId - the public identifier of the unparsed entitypublic Iterator<String> getUnparsedEntityNames()
getUnparsedEntityNames in interface DocumentInfopublic String[] getUnparsedEntity(String name)
getUnparsedEntity in interface DocumentInfoname - the name of the entitypublic int getTypeAnnotation()
getTypeAnnotation in interface NodeInfogetTypeAnnotation in class NodeImplpublic void copy(Receiver out, int copyOptions, int locationId) throws XPathException
copy in interface NodeInfoout - the Receiver to which the node should be copied. It is the caller's
responsibility to ensure that this Receiver is open before the method is called
(or that it is self-opening), and that it is closed after use.copyOptions - a selection of the options defined in CopyOptionslocationId - If non-zero, identifies the location of the instruction
that requested this copy. If zero, indicates that the location informationXPathExceptionpublic void replaceStringValue(CharSequence stringValue)
replaceStringValue in interface MutableNodeInfostringValue - the new string valuepublic void resetIndexes()
resetIndexes in interface MutableDocumentInfopublic void setUserData(String key, Object value)
getUserData(java.lang.String)setUserData in interface DocumentInfokey - 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 DocumentInfokey - A string giving the name of the property to be retrieved.