Package net.sf.saxon.om
Class GenericTreeInfo
java.lang.Object
net.sf.saxon.om.GenericTreeInfo
- Direct Known Subclasses:
AxiomDocument
,DocumentWrapper
,DOM4JDocumentWrapper
,DominoTree
,JDOM2DocumentWrapper
,RebasedDocument
,SpaceStrippedDocument
,TinyTree
,TypeStrippedDocument
,VirtualTreeInfo
A generic (model-independent) implementation of the TreeInfo interface, suitable for use with all
tree models where the object representing the document node does not itself act as the TreeInfo
implementation
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGenericTreeInfo
(Configuration config) Create the TreeInfoGenericTreeInfo
(Configuration config, NodeInfo root) Create the TreeInfo -
Method Summary
Modifier and TypeMethodDescriptionGet the Configuration to which this tree belongslong
Get the document number, which identifies this tree uniquely within a ConfigurationGet the durability of nodes in the tree.Get the Public ID of the entity containing the node.Get the NodeInfo object representing the root of the tree (not necessarily a document node)Get details of space stripping action that was applied to this document during construction.Get the systemId of the document nodeString[]
getUnparsedEntity
(String name) Get the unparsed entity with a given nameGet the list of unparsed entities defined in this documentgetUserData
(String key) Get user data held in the tree.boolean
Ask whether the tree is mutable.boolean
Get the element with a given ID, if anyvoid
setConfiguration
(Configuration config) Set the configuration (containing the name pool used for all names in this tree)void
setDocumentNumber
(long documentNumber) Set the document number, which identifies this tree uniquely within a Configurationvoid
setDurability
(Durability durability) Set the durability property of this node treevoid
setRootNode
(NodeInfo root) Set the root node of the treevoid
Set details of space stripping action that was applied to this document during construction.void
setSystemId
(String systemId) Set the systemId of the document node (for most implementations, this is likely to be the systemId of the entire tree)void
setUserData
(String key, Object value) Set user data on the tree.
-
Field Details
-
root
-
-
Constructor Details
-
GenericTreeInfo
Create the TreeInfo- Parameters:
config
- the Saxon Configuration
-
GenericTreeInfo
Create the TreeInfo- Parameters:
config
- the Saxon Configurationroot
- the root node- Throws:
IllegalArgumentException
- if the supplied node is not parentless
-
-
Method Details
-
setConfiguration
Set the configuration (containing the name pool used for all names in this tree)- Parameters:
config
- the configuration
-
getConfiguration
Get the Configuration to which this tree belongs- Specified by:
getConfiguration
in interfaceTreeInfo
- Returns:
- the configuration
-
setRootNode
Set the root node of the tree- Parameters:
root
- the root node (not necessarily a document node)- Throws:
IllegalArgumentException
- if the supplied node is not parentless
-
getRootNode
Get the NodeInfo object representing the root of the tree (not necessarily a document node)- Specified by:
getRootNode
in interfaceTreeInfo
- Returns:
- the root node
-
setSystemId
Set the systemId of the document node (for most implementations, this is likely to be the systemId of the entire tree)- Specified by:
setSystemId
in interfaceSource
- Parameters:
systemId
- the system ID
-
getSystemId
Get the systemId of the document node- Specified by:
getSystemId
in interfaceSource
- Returns:
- the system ID
-
getPublicId
Get the Public ID of the entity containing the node.- Returns:
- null (always)
- Since:
- 9.7
-
getDocumentNumber
public long getDocumentNumber()Get the document number, which identifies this tree uniquely within a Configuration- Specified by:
getDocumentNumber
in interfaceTreeInfo
- Returns:
- the document number
-
setDocumentNumber
public void setDocumentNumber(long documentNumber) Set the document number, which identifies this tree uniquely within a Configuration- Parameters:
documentNumber
- the document number allocated to this tree
-
selectID
Get the element with a given ID, if any- Specified by:
selectID
in interfaceTreeInfo
- Parameters:
id
- the required ID valuegetParent
- true if running the element-with-id() function rather than the id() function; the difference is that in the case of an element of type xs:ID, the parent of the element should be returned, not the element itself.- Returns:
- the element with the given ID, or null if there is no such ID present (or if the parser has not notified attributes as being of type ID)
- Since:
- 8.4. Second argument added in 9.2.
-
setDurability
Set the durability property of this node tree- Parameters:
durability
- the durability. This (a) indicates how long the node is expected to remain in memory, and (b) whether the node is mutable. This information is used when the node appears in the arguments to a memo function.
-
getDurability
Description copied from interface:TreeInfo
Get the durability of nodes in the tree. This affects how they are handled in a memo function cache, to optimize memory and garbage collection. By default, all nodes are considered durable unless otherwise specified- Specified by:
getDurability
in interfaceTreeInfo
- Returns:
- the durability property of this node tree
-
isMutable
public boolean isMutable()Description copied from interface:TreeInfo
Ask whether the tree is mutable. A mutable tree can be modified (without changes to node identity) using XQuery Update primitives, or equivalents in other languages (such as Saxon XSLT extensions). "Mutable" here means mutable using XSLT/XQuery mechanisms, not using subversive lower-level mechanisms such as external DOM updates. To be mutable, it is necessary that its nodes implement theMutableNodeInfo
interface; but this is not sufficient, because some tree implementations that support mutability interfaces may have optimizations for the case of non-mutability. -
getUnparsedEntityNames
Get the list of unparsed entities defined in this document- Specified by:
getUnparsedEntityNames
in interfaceTreeInfo
- Returns:
- an Iterator, whose items are of type String, containing the names of all unparsed entities defined in this document. If there are no unparsed entities or if the information is not available then an empty iterator is returned
- Since:
- 9.1
-
getUnparsedEntity
Get the unparsed entity with a given name- Specified by:
getUnparsedEntity
in interfaceTreeInfo
- Parameters:
name
- the name of the entity- Returns:
- if the entity exists, return an array of two Strings, the first holding the system ID of the entity (as an absolute URI if possible), the second holding the public ID if there is one, or null if not. If the entity does not exist, the method returns null. Applications should be written on the assumption that this array may be extended in the future to provide additional information.
- Since:
- 8.4
-
setSpaceStrippingRule
Set details of space stripping action that was applied to this document during construction. This ensures that space stripping is not applied twice to the same document.- Specified by:
setSpaceStrippingRule
in interfaceTreeInfo
- Parameters:
rule
- details of the space stripping rules that have been applied to this document during its construction.- Since:
- 9.9
-
getSpaceStrippingRule
Get details of space stripping action that was applied to this document during construction. This ensures that space stripping is not applied twice to the same document.- Specified by:
getSpaceStrippingRule
in interfaceTreeInfo
- Returns:
- details of the space stripping rules that have been applied to this
document during its construction. By default, returns
NoElementsSpaceStrippingRule
, indicating that no space stripping has been applied - Since:
- 9.9
-
setUserData
Set user data on the tree. The user data can be retrieved subsequently usinggetUserData(java.lang.String)
- Specified by:
setUserData
in interfaceTreeInfo
- Parameters:
key
- 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
-
getUserData
Get user data held in the tree. This retrieves properties previously set usingsetUserData(java.lang.String, java.lang.Object)
- Specified by:
getUserData
in interfaceTreeInfo
- Parameters:
key
- A string giving the name of the property to be retrieved.- Returns:
- the value of the property, or null if the property has not been defined.
-
isStreamed
public boolean isStreamed()
-