Package com.icl.saxon.tinytree
Class TinyDocumentImpl
- java.lang.Object
-
- com.icl.saxon.om.AbstractNode
-
- com.icl.saxon.tinytree.TinyDocumentImpl
-
- All Implemented Interfaces:
DocumentInfo,NodeInfo,DOMLocator,Source,SourceLocator,Document,Node
public final class TinyDocumentImpl extends AbstractNode implements DocumentInfo, Document
A node in the XML parse tree representing the Document itself (or equivalently, the root node of the Document).
-
-
Field Summary
Fields Modifier and Type Field Description protected int[]attCodeprotected int[]attParentprotected String[]attValueprotected char[]charBufferprotected intcharBufferLengthprotected StringBuffercommentBufferprotected short[]depthprotected TinyDocumentImpldocumentprotected intlastLevelOneNodeprotected int[]lengthprotected int[]nameCodeprotected int[]namespaceCodeprotected int[]namespaceParentprotected int[]nextprotected intnodeNrprotected byte[]nodeTypeprotected intnumberOfAttributesprotected intnumberOfNamespacesprotected intnumberOfNodesprotected int[]offsetprotected com.icl.saxon.tinytree.TinyNodeImplparentprotected int[]prior-
Fields inherited from class com.icl.saxon.om.AbstractNode
NODE_LETTER
-
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
-
-
Constructor Summary
Constructors Constructor Description TinyDocumentImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddAttribute(int parent0, int code0, String type0, String value0)protected voidaddNamespace(int parent0, int nscode0)protected voidaddNode(short type0, int depth0, int offset0, int length0, int nameCode0)NodeadoptNode(Node source)Attempts to adopt a node from another document to this document.protected voidappendChars(char[] chars, int start, int length)intcompareOrder(NodeInfo other)Determine the relative position of this node and another node, in document order.voidcopy(Outputter out)Copy this node to a given outputtervoidcopyStringValue(Outputter out)Copy the string-value of this node to a given outputtervoiddiagnosticDump()Produce diagnostic print of main tree arraysprotected voidensureAttributeCapacity()protected voidensureNamespaceCapacity()protected voidensureNodeCapacity()protected voidensurePriorIndex()On demand, make an index for quick access to preceding-sibling nodesStringgenerateId()Get a character string that uniquely identifies this node within the documentprotected AxisEnumerationgetAllElements(int fingerprint)Get a list of all elements with a given name.protected com.icl.saxon.tinytree.TinyAttributeImplgetAttributeNode(int nr)Make a (transient) attribute node from the array of attributesStringgetAttributeValue(int fingerprint)Get the value of a given attribute of this nodeStringgetAttributeValue(String uri, String localName)Find the value of a given attribute of this node.StringgetBaseURI()Get the base URI of this root node.StringgetDisplayName()Get the display name of this node.DocumentInfogetDocumentRoot()Get the root (document) nodeStringgetDocumentURI()The location of the document ornullif undefined or if theDocumentwas created usingDOMImplementation.createDocument.DOMConfigurationgetDomConfig()The configuration used whenDocument.normalizeDocument()is invoked.AxisEnumerationgetEnumeration(byte axisNumber, NodeTest nodeTest)Return an enumeration over the nodes reached by the given axis from this nodeintgetFingerprint()Get the fingerprint of the node, used for matching namesStringgetInputEncoding()An attribute specifying the encoding used for this document at the time of the parsing.HashtablegetKeyIndex(KeyManager keymanager, int fingerprint)Get the index for a given keyintgetLineNumber()Get the line number of this root node.protected intgetLineNumber(int sequence)Get the line number for an element.StringgetLocalName()Get the local name of this node.intgetNameCode()Get the name code of the node, used for matching namesNamePoolgetNamePool()Get the name pool used for the names in this documentprotected com.icl.saxon.tinytree.TinyNamespaceImplgetNamespaceNode(int nr)Make a (transient) namespace node from the array of namespace declarationscom.icl.saxon.tinytree.TinyNodeImplgetNode(int nr)shortgetNodeType()Return the type of node.NodegetOriginatingNode()Get the node corresponding to this javax.xml.transform.dom.DOMLocatorNodeInfogetParent()Find the parent node of this node.StringgetPrefix()Get the prefix part of the name of this node.longgetSequenceNumber()Get the node sequence number (in document order).booleangetStrictErrorChecking()An attribute specifying whether error checking is enforced or not.StringgetStringValue()Return the string-value of the node, that is, the concatenation of the character content of all descendent elements and text nodes.StringgetSystemId()Get the system id of this root nodeprotected StringgetSystemId(int seq)Get the system id of an element in the documentStringgetUnparsedEntity(String name)Get the unparsed entity with a given nameStringgetURI()Get the URI part of the name of this node.StringgetXmlEncoding()An attribute specifying, as part of the XML declaration, the encoding of this document.booleangetXmlStandalone()An attribute specifying, as part of the XML declaration, whether this document is standalone.StringgetXmlVersion()An attribute specifying, as part of the XML declaration, the version number of this document.booleanhasAttributes()Returns whether this node has any attributes.booleanhasChildNodes()Determine if the node has children.booleanisSameNodeInfo(NodeInfo other)Determine whether this is the same node as another nodeprotected booleanisUsingNamespaces()determine whether this document uses namespacesvoidnormalizeDocument()This method acts as if the document was going through a save and load cycle, putting the document in a "normal" form.voidoutputNamespaceNodes(Outputter out, boolean includeAncestors)Output all namespace nodes associated with this element.NoderenameNode(Node n, String namespaceURI, String qualifiedName)Rename an existing node of typeELEMENT_NODEorATTRIBUTE_NODE.NodeInfoselectID(String id)Get the element with a given ID.voidsetDocumentURI(String documentURI)The location of the document ornullif undefined or if theDocumentwas created usingDOMImplementation.createDocument.voidsetKeyIndex(KeyManager keymanager, int fingerprint, Hashtable keyindex)Set the index for a given key.voidsetLineNumber(int line)Set the line number of the node within its source document entityprotected voidsetLineNumber(int sequence, int line)Set the line number for an element.voidsetLineNumbering()Set line numbering onvoidsetNamePool(NamePool pool)Set the name pool used for all names in this documentprotected voidsetParentNode(com.icl.saxon.tinytree.TinyNodeImpl parent)Set the parent of this node.voidsetStrictErrorChecking(boolean strictErrorChecking)An attribute specifying whether error checking is enforced or not.protected voidsetSystemId(int seq, String uri)Set the system id of an element in the documentvoidsetSystemId(String uri)Set the system id of this nodeprotected voidsetUnparsedEntity(String name, String uri)Set an unparsed entity URI associated with this document.voidsetXmlStandalone(boolean xmlStandalone)An attribute specifying, as part of the XML declaration, whether this document is standalone.voidsetXmlVersion(String xmlVersion)An attribute specifying, as part of the XML declaration, the version number of this document.protected voidtruncate(int nodes)Truncate the tree: used in preview mode to delete an element after it has been processed-
Methods inherited from class com.icl.saxon.om.AbstractNode
appendChild, appendData, cloneNode, compareDocumentPosition, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, deleteData, disallowUpdate, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getChildNodes, getColumnNumber, getData, getDoctype, getDocumentElement, getElementById, getElementsByTagName, getElementsByTagNameNS, getFeature, getFirstChild, getImplementation, getLastChild, getLength, getName, getNamespaceURI, getNextSibling, getNodeName, getNodeValue, getOwnerDocument, getOwnerElement, getParentNode, getPreviousSibling, getPublicId, getSchemaTypeInfo, getSpecified, getTagName, getTextContent, getUserData, getValue, getWholeText, hasAttribute, hasAttributeNS, importNode, insertBefore, insertData, isDefaultNamespace, isElementContentWhitespace, isEqualNode, isId, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, replaceChild, replaceData, replaceWholeText, setAttributeNode, setAttributeNodeNS, setAttributeNS, setData, setIdAttribute, setIdAttributeNode, setIdAttributeNS, setNodeValue, setPrefix, setTextContent, setUserData, setValue, splitText, substringData, supports
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.w3c.dom.Document
createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, getDoctype, getDocumentElement, getElementById, getElementsByTagName, getElementsByTagNameNS, getImplementation, importNode
-
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, compareDocumentPosition, getAttributes, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
-
Methods inherited from interface com.icl.saxon.om.NodeInfo
compareOrder, copyStringValue, getAttributeValue, getAttributeValue, getDisplayName, getEnumeration, getFingerprint, getLocalName, getNameCode, getPrefix, getStringValue, getURI, hasChildNodes, isSameNodeInfo, outputNamespaceNodes
-
-
-
-
Field Detail
-
charBuffer
protected char[] charBuffer
-
charBufferLength
protected int charBufferLength
-
commentBuffer
protected StringBuffer commentBuffer
-
numberOfNodes
protected int numberOfNodes
-
lastLevelOneNode
protected int lastLevelOneNode
-
nodeType
protected byte[] nodeType
-
depth
protected short[] depth
-
next
protected int[] next
-
offset
protected int[] offset
-
length
protected int[] length
-
nameCode
protected int[] nameCode
-
prior
protected int[] prior
-
numberOfAttributes
protected int numberOfAttributes
-
attParent
protected int[] attParent
-
attCode
protected int[] attCode
-
attValue
protected String[] attValue
-
numberOfNamespaces
protected int numberOfNamespaces
-
namespaceParent
protected int[] namespaceParent
-
namespaceCode
protected int[] namespaceCode
-
document
protected TinyDocumentImpl document
-
nodeNr
protected int nodeNr
-
parent
protected com.icl.saxon.tinytree.TinyNodeImpl parent
-
-
Method Detail
-
setNamePool
public void setNamePool(NamePool pool)
Set the name pool used for all names in this document- Specified by:
setNamePoolin interfaceDocumentInfo
-
getNamePool
public NamePool getNamePool()
Get the name pool used for the names in this document- Specified by:
getNamePoolin interfaceDocumentInfo
-
ensureNodeCapacity
protected void ensureNodeCapacity()
-
ensureAttributeCapacity
protected void ensureAttributeCapacity()
-
ensureNamespaceCapacity
protected void ensureNamespaceCapacity()
-
addNode
protected void addNode(short type0, int depth0, int offset0, int length0, int nameCode0)
-
appendChars
protected void appendChars(char[] chars, int start, int length)
-
truncate
protected void truncate(int nodes)
Truncate the tree: used in preview mode to delete an element after it has been processed
-
ensurePriorIndex
protected void ensurePriorIndex()
On demand, make an index for quick access to preceding-sibling nodes
-
addNamespace
protected void addNamespace(int parent0, int nscode0)
-
getNode
public com.icl.saxon.tinytree.TinyNodeImpl getNode(int nr)
-
getSequenceNumber
public long getSequenceNumber()
Get the node sequence number (in document order). Sequence numbers are monotonic but not consecutive.
-
getAttributeNode
protected com.icl.saxon.tinytree.TinyAttributeImpl getAttributeNode(int nr)
Make a (transient) attribute node from the array of attributes
-
isUsingNamespaces
protected boolean isUsingNamespaces()
determine whether this document uses namespaces
-
getNamespaceNode
protected com.icl.saxon.tinytree.TinyNamespaceImpl getNamespaceNode(int nr)
Make a (transient) namespace node from the array of namespace declarations
-
setSystemId
public void setSystemId(String uri)
Set the system id of this node- Specified by:
setSystemIdin interfaceSource
-
getSystemId
public String getSystemId()
Get the system id of this root node- Specified by:
getSystemIdin interfaceNodeInfo- Specified by:
getSystemIdin interfaceSource- Specified by:
getSystemIdin interfaceSourceLocator- 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.
-
getBaseURI
public String getBaseURI()
Get the base URI of this root node. For a root node the base URI is the same as the System ID.- Specified by:
getBaseURIin interfaceNode- Specified by:
getBaseURIin interfaceNodeInfo
-
setSystemId
protected void setSystemId(int seq, String uri)Set the system id of an element in the document
-
getSystemId
protected String getSystemId(int seq)
Get the system id of an element in the document
-
setLineNumbering
public void setLineNumbering()
Set line numbering on
-
setLineNumber
protected void setLineNumber(int sequence, int line)Set the line number for an element. Ignored if line numbering is off.
-
getLineNumber
protected int getLineNumber(int sequence)
Get the line number for an element. Return -1 if line numbering is off.
-
getLineNumber
public int getLineNumber()
Get the line number of this root node.- Specified by:
getLineNumberin interfaceNodeInfo- Specified by:
getLineNumberin interfaceSourceLocator- Returns:
- 0 always
-
getNodeType
public final short getNodeType()
Return the type of node.- Specified by:
getNodeTypein interfaceNode- Specified by:
getNodeTypein interfaceNodeInfo- Returns:
- NodeInfo.ROOT (always)
-
getParent
public NodeInfo getParent()
Find the parent node of this node.
-
getDocumentRoot
public DocumentInfo getDocumentRoot()
Get the root (document) node- Specified by:
getDocumentRootin interfaceNodeInfo- Returns:
- the DocumentInfo representing this document
-
generateId
public String generateId()
Get a character string that uniquely identifies this node within the document- Specified by:
generateIdin interfaceNodeInfo- Returns:
- the empty string
-
getAllElements
protected AxisEnumeration getAllElements(int fingerprint)
Get a list of all elements with a given name. This is implemented as a memo function: the first time it is called for a particular element type, it remembers the result for next time.
-
selectID
public NodeInfo selectID(String id)
Get the element with a given ID.- Specified by:
selectIDin interfaceDocumentInfo- Parameters:
id- The unique ID of the required element, previously registered using registerID()- Returns:
- The NodeInfo (always an Element) for the given ID if one has been registered, otherwise null.
-
getKeyIndex
public Hashtable getKeyIndex(KeyManager keymanager, int fingerprint)
Get the index for a given key- Specified by:
getKeyIndexin interfaceDocumentInfo- Parameters:
keymanager- The key manager managing this keyfingerprint- The fingerprint of the name of the key (unique with the key manager)- Returns:
- The index, if one has been built, in the form of a Hashtable that maps the key value to a set of nodes having that key value. If no index has been built, returns null.
-
setKeyIndex
public void setKeyIndex(KeyManager keymanager, int fingerprint, Hashtable keyindex)
Set the index for a given key. The method is synchronized because the same document can be used by several stylesheets at the same time.- Specified by:
setKeyIndexin interfaceDocumentInfo- Parameters:
keymanager- The key manager managing this keyfingerprint- The fingerprint of the name of the key (unique with the key manager)keyindex- the index, in the form of a Hashtable that maps the key value to a set of nodes having that key value. Or the String "under construction", indicating that the index is being built.
-
setUnparsedEntity
protected void setUnparsedEntity(String name, String uri)
Set an unparsed entity URI associated with this document. For system use only, while building the document.
-
getUnparsedEntity
public String getUnparsedEntity(String name)
Get the unparsed entity with a given name- Specified by:
getUnparsedEntityin interfaceDocumentInfo- Parameters:
name- the name of the entity- Returns:
- the URI of the entity if there is one, or empty string if not
-
copy
public void copy(Outputter out) throws TransformerException
Copy this node to a given outputter- Specified by:
copyin interfaceNodeInfo- Throws:
TransformerException
-
diagnosticDump
public void diagnosticDump()
Produce diagnostic print of main tree arrays
-
adoptNode
public Node adoptNode(Node source) throws DOMException
Attempts to adopt a node from another document to this document.- Specified by:
adoptNodein interfaceDocument- Parameters:
source- The node to move into this document.- Returns:
- The adopted node, or
nullif this operation fails, such as when the source node comes from a different implementation. - Throws:
DOMException- NOT_SUPPORTED_ERR: Raised if the source node is of typeDOCUMENT,DOCUMENT_TYPE.
NO_MODIFICATION_ALLOWED_ERR: Raised when the source node is readonly.- Since:
- DOM Level 3
-
getDocumentURI
public String getDocumentURI()
The location of the document ornullif undefined or if theDocumentwas created usingDOMImplementation.createDocument. No lexical checking is performed when setting this attribute; this could result in anullvalue returned when usingNode.baseURI.
Beware that when theDocumentsupports the feature "HTML" [DOM Level 2 HTML] , the href attribute of the HTML BASE element takes precedence over this attribute when computingNode.baseURI.- Specified by:
getDocumentURIin interfaceDocument- Since:
- DOM Level 3
-
getDomConfig
public DOMConfiguration getDomConfig()
The configuration used whenDocument.normalizeDocument()is invoked.- Specified by:
getDomConfigin interfaceDocument- Since:
- DOM Level 3
-
getInputEncoding
public String getInputEncoding()
An attribute specifying the encoding used for this document at the time of the parsing. This isnullwhen it is not known, such as when theDocumentwas created in memory.- Specified by:
getInputEncodingin interfaceDocument- Since:
- DOM Level 3
-
getStrictErrorChecking
public boolean getStrictErrorChecking()
An attribute specifying whether error checking is enforced or not. When set tofalse, the implementation is free to not test every possible error case normally defined on DOM operations, and not raise anyDOMExceptionon DOM operations or report errors while usingDocument.normalizeDocument(). In case of error, the behavior is undefined. This attribute istrueby default.- Specified by:
getStrictErrorCheckingin interfaceDocument- Since:
- DOM Level 3
-
getXmlEncoding
public String getXmlEncoding()
An attribute specifying, as part of the XML declaration, the encoding of this document. This isnullwhen unspecified or when it is not known, such as when theDocumentwas created in memory.- Specified by:
getXmlEncodingin interfaceDocument- Since:
- DOM Level 3
-
getXmlStandalone
public boolean getXmlStandalone()
An attribute specifying, as part of the XML declaration, whether this document is standalone. This isfalsewhen unspecified.Note: No verification is done on the value when setting this attribute. Applications should use
Document.normalizeDocument()with the "validate" parameter to verify if the value matches the validity constraint for standalone document declaration as defined in [XML 1.0].- Specified by:
getXmlStandalonein interfaceDocument- Since:
- DOM Level 3
-
getXmlVersion
public String getXmlVersion()
An attribute specifying, as part of the XML declaration, the version number of this document. If there is no declaration and if this document supports the "XML" feature, the value is"1.0".- Specified by:
getXmlVersionin interfaceDocument- Since:
- DOM Level 3
-
normalizeDocument
public void normalizeDocument()
This method acts as if the document was going through a save and load cycle, putting the document in a "normal" form.- Specified by:
normalizeDocumentin interfaceDocument- Since:
- DOM Level 3
-
renameNode
public Node renameNode(Node n, String namespaceURI, String qualifiedName) throws DOMException
Rename an existing node of typeELEMENT_NODEorATTRIBUTE_NODE.- Specified by:
renameNodein interfaceDocument- Parameters:
n- The node to rename.namespaceURI- The new namespace URI.qualifiedName- The new qualified name.- Returns:
- The renamed node. This is either the specified node or the new node that was created to replace the specified node.
- Throws:
DOMException- NOT_SUPPORTED_ERR: Raised when the type of the specified node is neitherELEMENT_NODEnorATTRIBUTE_NODE, or if the implementation does not support the renaming of the document element.
INVALID_CHARACTER_ERR: Raised if the new qualified name is not an XML name according to the XML version in use specified in theDocument.xmlVersionattribute.
WRONG_DOCUMENT_ERR: Raised when the specified node was created from a different document than this document.
NAMESPACE_ERR: Raised if thequalifiedNameis a malformed qualified name, if thequalifiedNamehas a prefix and thenamespaceURIisnull, or if thequalifiedNamehas a prefix that is "xml" and thenamespaceURIis different from " http://www.w3.org/XML/1998/namespace" [XML Namespaces] . Also raised, when the node being renamed is an attribute, if thequalifiedName, or its prefix, is "xmlns" and thenamespaceURIis different from "http://www.w3.org/2000/xmlns/".- Since:
- DOM Level 3
-
setDocumentURI
public void setDocumentURI(String documentURI)
The location of the document ornullif undefined or if theDocumentwas created usingDOMImplementation.createDocument. No lexical checking is performed when setting this attribute; this could result in anullvalue returned when usingNode.baseURI.
Beware that when theDocumentsupports the feature "HTML" [DOM Level 2 HTML] , the href attribute of the HTML BASE element takes precedence over this attribute when computingNode.baseURI.- Specified by:
setDocumentURIin interfaceDocument- Since:
- DOM Level 3
-
setStrictErrorChecking
public void setStrictErrorChecking(boolean strictErrorChecking)
An attribute specifying whether error checking is enforced or not. When set tofalse, the implementation is free to not test every possible error case normally defined on DOM operations, and not raise anyDOMExceptionon DOM operations or report errors while usingDocument.normalizeDocument(). In case of error, the behavior is undefined. This attribute istrueby default.- Specified by:
setStrictErrorCheckingin interfaceDocument- Since:
- DOM Level 3
-
setXmlStandalone
public void setXmlStandalone(boolean xmlStandalone) throws DOMExceptionAn attribute specifying, as part of the XML declaration, whether this document is standalone. This isfalsewhen unspecified.Note: No verification is done on the value when setting this attribute. Applications should use
Document.normalizeDocument()with the "validate" parameter to verify if the value matches the validity constraint for standalone document declaration as defined in [XML 1.0].- Specified by:
setXmlStandalonein interfaceDocument- Throws:
DOMException- NOT_SUPPORTED_ERR: Raised if this document does not support the "XML" feature.- Since:
- DOM Level 3
-
setXmlVersion
public void setXmlVersion(String xmlVersion) throws DOMException
An attribute specifying, as part of the XML declaration, the version number of this document. If there is no declaration and if this document supports the "XML" feature, the value is"1.0". If this document does not support the "XML" feature, the value is alwaysnull. Changing this attribute will affect methods that check for invalid characters in XML names. Application should invokeDocument.normalizeDocument()in order to check for invalid characters in theNodes that are already part of thisDocument.
DOM applications may use theDOMImplementation.hasFeature(feature, version)method with parameter values "XMLVersion" and "1.0" (respectively) to determine if an implementation supports [XML 1.0]. DOM applications may use the same method with parameter values "XMLVersion" and "1.1" (respectively) to determine if an implementation supports [XML 1.1]. In both cases, in order to support XML, an implementation must also support the "XML" feature defined in this specification.Documentobjects supporting a version of the "XMLVersion" feature must not raise aNOT_SUPPORTED_ERRexception for the same version number when usingDocument.xmlVersion.- Specified by:
setXmlVersionin interfaceDocument- Throws:
DOMException- NOT_SUPPORTED_ERR: Raised if the version is set to a value that is not supported by thisDocumentor if this document does not support the "XML" feature.- Since:
- DOM Level 3
-
hasChildNodes
public boolean hasChildNodes()
Determine if the node has children.- Specified by:
hasChildNodesin interfaceNode- Specified by:
hasChildNodesin interfaceNodeInfo- Returns:
trueif this node has any attributes,falseotherwise.
-
getStringValue
public String getStringValue()
Return the string-value of the node, that is, the concatenation of the character content of all descendent elements and text nodes.- Returns:
- the accumulated character content of the element, including descendant elements.
-
copyStringValue
public void copyStringValue(Outputter out) throws TransformerException
Copy the string-value of this node to a given outputter- Specified by:
copyStringValuein interfaceNodeInfo- Overrides:
copyStringValuein classAbstractNode- Throws:
TransformerException
-
setParentNode
protected void setParentNode(com.icl.saxon.tinytree.TinyNodeImpl parent)
Set the parent of this node. Providing this information is useful, if it is known, because otherwise getParent() has to search backwards through the document.
-
isSameNodeInfo
public boolean isSameNodeInfo(NodeInfo other)
Determine whether this is the same node as another node- Specified by:
isSameNodeInfoin interfaceNodeInfo- Specified by:
isSameNodeInfoin classAbstractNode- Returns:
- true if this Node object and the supplied Node object represent the same node in the tree.
-
getOriginatingNode
public Node getOriginatingNode()
Get the node corresponding to this javax.xml.transform.dom.DOMLocator- Specified by:
getOriginatingNodein interfaceDOMLocator- Overrides:
getOriginatingNodein classAbstractNode
-
setLineNumber
public void setLineNumber(int line)
Set the line number of the node within its source document entity
-
compareOrder
public final 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:
compareOrderin interfaceNodeInfo- Specified by:
compareOrderin classAbstractNode- 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())
-
getFingerprint
public int getFingerprint()
Get the fingerprint of the node, used for matching names- Specified by:
getFingerprintin interfaceNodeInfo- Specified by:
getFingerprintin classAbstractNode
-
getNameCode
public int getNameCode()
Get the name code of the node, used for matching names- Specified by:
getNameCodein interfaceNodeInfo- Specified by:
getNameCodein classAbstractNode- See Also:
allocate,getFingerprint
-
getPrefix
public String getPrefix()
Get the prefix part of the name of this node. This is the name before the ":" if any.
-
getURI
public String getURI()
Get the URI part of the name of this node. This is the URI corresponding to the prefix, or the URI of the default namespace if appropriate.- Specified by:
getURIin interfaceNodeInfo- Specified by:
getURIin classAbstractNode- Returns:
- The URI of the namespace of this node. For an unnamed node, or for an element or attribute in the default namespace, return an empty string.
-
getDisplayName
public String getDisplayName()
Get the display name of this node. For elements and attributes this is [prefix:]localname. For unnamed nodes, it is an empty string.- Specified by:
getDisplayNamein interfaceNodeInfo- Overrides:
getDisplayNamein classAbstractNode- Returns:
- The display name of this node. For a node with no name, return an empty string.
-
getLocalName
public String getLocalName()
Get the local name of this node.- Specified by:
getLocalNamein interfaceNode- Specified by:
getLocalNamein interfaceNodeInfo- Specified by:
getLocalNamein classAbstractNode- Returns:
- The local name of this node. For a node with no name, return an empty string.
-
getEnumeration
public AxisEnumeration getEnumeration(byte axisNumber, NodeTest nodeTest)
Return an enumeration over the nodes reached by the given axis from this node- Specified by:
getEnumerationin interfaceNodeInfo- Specified by:
getEnumerationin classAbstractNode- Parameters:
axisNumber- Identifies the required axis, eg. Axis.CHILD or Axis.PARENTnodeTest- A pattern to be matched by the returned nodes- Returns:
- a AxisEnumeration that scans the nodes reached by the axis in turn.
-
hasAttributes
public boolean hasAttributes()
Returns whether this node has any attributes.- Specified by:
hasAttributesin interfaceNode- Specified by:
hasAttributesin classAbstractNode- Returns:
trueif this node has any attributes,falseotherwise.- Since:
- DOM Level 2
-
getAttributeValue
public String getAttributeValue(String uri, String localName)
Find the value of a given attribute of this node.
This method is defined on all nodes to meet XSL requirements, but for nodes other than elements it will always return null.- Specified by:
getAttributeValuein interfaceNodeInfo- Specified by:
getAttributeValuein classAbstractNode- Parameters:
uri- the namespace uri of an attributelocalName- the local name of an attribute- Returns:
- the value of the attribute, if it exists, otherwise null
-
getAttributeValue
public String getAttributeValue(int fingerprint)
Get the value of a given attribute of this node- Specified by:
getAttributeValuein interfaceNodeInfo- Specified by:
getAttributeValuein classAbstractNode- Parameters:
fingerprint- The fingerprint of the attribute name- Returns:
- the attribute value if it exists or null if not
-
outputNamespaceNodes
public void outputNamespaceNodes(Outputter out, boolean includeAncestors) throws TransformerException
Output all namespace nodes associated with this element. Does nothing if the node is not an element.- Specified by:
outputNamespaceNodesin interfaceNodeInfo- Overrides:
outputNamespaceNodesin classAbstractNode- Parameters:
out- The relevant outputterincludeAncestors- True if namespaces declared on ancestor elements must be output; false if it is known that these are already on the result tree- Throws:
TransformerException
-
-