public final class DocumentImpl extends NodeImpl implements DocumentInfo
A DocumentImpl object may either represent a real document node, or it may represent an imaginary container for a parentless element.
?????? | ????? |
---|---|
protected java.lang.Object |
children |
protected int |
sequence |
index, NODE_LETTER, parent
ALL_NAMESPACES, EMPTY_NAMESPACE_LIST, IS_DTD_TYPE, IS_NILLED, LOCAL_NAMESPACES, NO_NAMESPACES
EMPTY_VALUE_ARRAY
?????? |
---|
DocumentImpl()
Create a DocumentImpl
|
?????? | ????? |
---|---|
void |
addChild(NodeImpl node,
int index)
Add a child node to this node.
|
void |
compact(int size)
Compact the space used by this node
|
void |
copy(Receiver out,
int whichNamespaces,
boolean copyAnnotations,
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(java.lang.String id)
Remove the entry for a given ID (when nodes are deleted).
|
protected AxisIterator |
enumerateChildren(NodeTest test)
Get an enumeration of the children of this node
|
void |
generateId(FastStringBuffer buffer)
Get a character string that uniquely identifies this node
|
java.lang.String |
getBaseURI()
Get the base URI of this root node.
|
Configuration |
getConfiguration()
Get the configuration previously set using setConfiguration
|
ElementImpl |
getDocumentElement()
Get the root (outermost) element.
|
int |
getDocumentNumber()
Get the unique document number
|
DocumentInfo |
getDocumentRoot()
Get the root (document) node
|
NodeInfo |
getFirstChild()
Get the first child node of the element
|
NodeInfo |
getLastChild()
Get the last child node of the element
|
int |
getLineNumber()
Get the line number of this root node.
|
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.
|
protected NodeImpl |
getNthChild(int n)
Get the nth child node of the element (numbering from 0)
|
int |
getNumberOfChildren()
Determine how many children the node has
|
DocumentImpl |
getPhysicalRoot()
Get the physical root of the tree.
|
NodeInfo |
getPreviousSibling()
Get previous sibling - always null
|
NodeInfo |
getRoot()
Get the root node
|
protected long |
getSequenceNumber()
Get the node sequence number (in document order).
|
java.lang.String |
getStringValue()
Return the string-value of the node, that is, the concatenation
of the character content of all descendent elements and text nodes.
|
java.lang.CharSequence |
getStringValueCS()
Get the value of the item as a CharSequence.
|
java.lang.String |
getSystemId()
Get the system id of this root node
|
java.lang.String[] |
getUnparsedEntity(java.lang.String name)
Get the unparsed entity with a given name
|
java.util.Iterator |
getUnparsedEntityNames()
Get the list of unparsed entities defined in this document
|
void |
graftLocationMap(DocumentImpl original)
Copy the system ID and line number map from another document
(used when grafting a simplified stylesheet)
|
boolean |
hasChildNodes()
Determine if the node has any children.
|
void |
insertChildren(NodeInfo[] source,
boolean atStart,
boolean inherit)
Insert copies of a sequence of nodes as children of this node.
|
protected void |
insertChildrenAt(NodeInfo[] source,
int index,
boolean inherit)
Insert children before or after a given existing child
|
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,
java.lang.String id)
Register a unique element ID.
|
protected void |
removeChild(NodeImpl child)
Remove a given child
|
protected void |
replaceChildrenAt(NodeInfo[] source,
int index,
boolean inherit)
Replace child at a given index by new children
|
void |
replaceStringValue(java.lang.CharSequence stringValue)
Replace the string-value of this node
|
NodeInfo |
selectID(java.lang.String id)
Get the element with a given ID.
|
void |
setBaseURI(java.lang.String uri)
Set the base URI of this document node
|
void |
setConfiguration(Configuration config)
Set the Configuration that contains this document
|
void |
setImaginary(boolean imaginary)
Set whether this is an imaginary document node
|
void |
setLineNumbering()
Set line numbering on
|
void |
setSystemId(java.lang.String uri)
Set the system id (base URI) of this node
|
protected void |
useChildrenArray(NodeImpl[] array)
Supply an array to be used for the array of children.
|
addNamespace, atomize, compareOrder, delete, equals, getAttributeValue, getColumnNumber, getDeclaredNamespaces, getDisplayName, getFingerprint, getLocalPart, getNameCode, getNextInDocument, getParent, getPrefix, getPreviousInDocument, getPublicId, getSiblingPosition, getTypeAnnotation, getTypedValue, getURI, insertSiblings, isId, isIdref, isNilled, isSameNodeInfo, iterateAxis, iterateAxis, putAttribute, removeAttribute, removeTypeAnnotation, rename, replace, setTypeAnnotation
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
atomize, compareOrder, equals, getAttributeValue, getColumnNumber, getDeclaredNamespaces, getDisplayName, getFingerprint, getLocalPart, getNameCode, getParent, getPrefix, getStringValue, getTypeAnnotation, getURI, hasChildNodes, hashCode, isId, isIdref, isNilled, isSameNodeInfo, iterateAxis, iterateAxis
getStringValueCS, getTypedValue
public void setConfiguration(Configuration config)
config
- the Saxon configurationpublic Configuration getConfiguration()
getConfiguration
???? NodeInfo
getConfiguration
??? NodeImpl
public NamePool getNamePool()
getNamePool
???? NodeInfo
getNamePool
??? NodeImpl
public Builder newBuilder()
newBuilder
???? MutableNodeInfo
newBuilder
??? NodeImpl
public void setImaginary(boolean imaginary)
imaginary
- if true, this is an imaginary node - the tree is really rooted at the topmost elementpublic boolean isImaginary()
public int getDocumentNumber()
getDocumentNumber
???? NodeInfo
getDocumentNumber
??? NodeImpl
public void graftLocationMap(DocumentImpl original)
original
- the document whose system ID and line number maps are to be grafted
onto this treepublic void setSystemId(java.lang.String uri)
setSystemId
???? javax.xml.transform.Source
setSystemId
??? NodeImpl
public java.lang.String getSystemId()
getSystemId
???? javax.xml.transform.Source
getSystemId
???? javax.xml.transform.SourceLocator
getSystemId
???? NodeInfo
getSystemId
??? NodeImpl
public void setBaseURI(java.lang.String uri)
uri
- the new base URIpublic java.lang.String getBaseURI()
getBaseURI
???? NodeInfo
getBaseURI
??? NodeImpl
public void setLineNumbering()
public int getLineNumber()
getLineNumber
???? javax.xml.transform.SourceLocator
getLineNumber
???? NodeInfo
getLineNumber
??? NodeImpl
public final int getNodeKind()
getNodeKind
???? NodeInfo
Type
public final NodeInfo getNextSibling()
getNextSibling
??? NodeImpl
public final NodeInfo getPreviousSibling()
getPreviousSibling
??? NodeImpl
public ElementImpl getDocumentElement()
public NodeInfo getRoot()
public DocumentInfo getDocumentRoot()
getDocumentRoot
???? NodeInfo
getDocumentRoot
??? NodeImpl
public DocumentImpl getPhysicalRoot()
getPhysicalRoot
??? NodeImpl
public void generateId(FastStringBuffer buffer)
generateId
???? NodeInfo
generateId
??? NodeImpl
buffer
- a buffer into which will be placed a string based on the document numberpublic void deIndex(NodeImpl node)
node
- the node to be removed from all indexesprotected void registerID(NodeInfo e, java.lang.String id)
e
- The Element having a particular unique ID valueid
- The unique ID valuepublic NodeInfo selectID(java.lang.String id)
selectID
???? DocumentInfo
id
- The unique ID of the required element, previously registered using registerID()protected void deregisterID(java.lang.String id)
id
- The id valuepublic java.util.Iterator getUnparsedEntityNames()
getUnparsedEntityNames
???? DocumentInfo
public java.lang.String[] getUnparsedEntity(java.lang.String name)
getUnparsedEntity
???? DocumentInfo
name
- the name of the entitypublic void copy(Receiver out, int whichNamespaces, boolean copyAnnotations, int locationId) throws XPathException
copy
???? NodeInfo
out
- 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.whichNamespaces
- in the case of an element, controls
which namespace nodes should be copied. Values are NodeInfo.NO_NAMESPACES
,
NodeInfo.LOCAL_NAMESPACES
, NodeInfo.ALL_NAMESPACES
copyAnnotations
- indicates whether the type annotations
of element and attribute nodes should be copiedlocationId
- If non-zero, identifies the location of the instruction
that requested this copy. If zero, indicates that the location information
for the original node is to be copied; in this case the Receiver must be
a LocationCopierXPathException
public void replaceStringValue(java.lang.CharSequence stringValue)
replaceStringValue
???? MutableNodeInfo
stringValue
- the new string valueprotected final long getSequenceNumber()
getSequenceNumber
??? NodeImpl
public final boolean hasChildNodes()
hasChildNodes
???? NodeInfo
hasChildNodes
??? NodeImpl
true
if the node has any children,
false
if the node has no children.public int getNumberOfChildren()
protected final AxisIterator enumerateChildren(NodeTest test)
test
- A NodeTest to be satisfied by the child nodes, or null
if all child node are to be returnedpublic final NodeInfo getFirstChild()
getFirstChild
??? NodeImpl
public final NodeInfo getLastChild()
getLastChild
??? NodeImpl
protected final NodeImpl getNthChild(int n)
n
- identifies the required childprotected void removeChild(NodeImpl child)
child
- the child to be removedpublic java.lang.String getStringValue()
Item.getStringValueCS()
public java.lang.CharSequence getStringValueCS()
NodeImpl
getStringValueCS
???? Item
getStringValueCS
???? ValueRepresentation
getStringValueCS
??? NodeImpl
Item.getStringValue()
protected void useChildrenArray(NodeImpl[] array)
array
- the array to be usedpublic void addChild(NodeImpl node, int index)
node
- the node to be added as a child of this nodeindex
- the position where the child is to be addedpublic 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
???? MutableNodeInfo
insertChildren
??? NodeImpl
source
- the nodes to be insertedatStart
- true if the new nodes are to be inserted before existing children; false if they areinherit
- true if the inserted nodes are to inherit the namespaces that are in-scope for their
new parent; false if such namespaces should be undeclared on the childrenprotected void insertChildrenAt(NodeInfo[] source, int index, boolean inherit)
source
- the children to be insertedindex
- the position before which they are to be inserted: 0 indicates insertion before the
first child, 1 insertion before the second child, and so on.inherit
- true if the inserted nodes are to inherit the namespaces that are in-scope for their
new parent; false if such namespaces should be undeclared on the childrenprotected void replaceChildrenAt(NodeInfo[] source, int index, boolean inherit)
source
- the children to be insertedindex
- the position at which they are to be inserted: 0 indicates replacement of the
first child, replacement of the second child, and so on. The effect is undefined if index
is out of rangeinherit
- set to true if the new child elements are to inherit the in-scope namespaces
of their new parentjava.lang.IllegalArgumentException
- if any of the replacement nodes is not an element, text,
comment, or processing instruction nodepublic void compact(int size)
size
- the number of actual children