public class RebasedDocument extends GenericTreeInfo
It is possible to map either base URIs or system IDs or both.
All properties of the nodes other than the base URI and system ID are unchanged.
The user-supplied functions supplied to compute the base URI and system ID will be applied to the underlying node in the "real" document. It is of course possible to supply a function that ignores the supplied input.
root
Constructor and Description |
---|
RebasedDocument(TreeInfo doc,
java.util.function.Function<NodeInfo,java.lang.String> baseUriMapper,
java.util.function.Function<NodeInfo,java.lang.String> systemIdMapper)
Create a rebased view of a document
|
Modifier and Type | Method and Description |
---|---|
java.util.function.Function<NodeInfo,java.lang.String> |
getBaseUriMapper()
Get the function that is used to map nodes in the underlying tree to a new base URI
|
java.util.function.Function<NodeInfo,java.lang.String> |
getSystemIdMapper()
Get the function that is used to map nodes in the underlying tree to a new system ID
|
TreeInfo |
getUnderlyingTree()
Get the underlying tree (the one whose nodes are being mapped to a new base URI and system ID)
|
boolean |
isTyped()
Ask whether the document contains any nodes whose type annotation is anything other than
UNTYPED.
|
NodeInfo |
selectID(java.lang.String id,
boolean getParent)
Get the element with a given ID, if any
|
RebasedNode |
wrap(NodeInfo node)
Create a wrapped node within this document
|
getConfiguration, getDocumentNumber, getPublicId, getRootNode, getSpaceStrippingRule, getSystemId, getUnparsedEntity, getUnparsedEntityNames, getUserData, isStreamed, setConfiguration, setDocumentNumber, setRootNode, setSpaceStrippingRule, setSystemId, setUserData
public RebasedDocument(TreeInfo doc, java.util.function.Function<NodeInfo,java.lang.String> baseUriMapper, java.util.function.Function<NodeInfo,java.lang.String> systemIdMapper)
doc
- the underlying documentbaseUriMapper
- a function that is applied to a node in the original document
to deliver the base URI of the corresponding node in the rebased documentsystemIdMapper
- a function that is applied to a node in the original document
to deliver the system ID of the corresponding node in the rebased documentpublic RebasedNode wrap(NodeInfo node)
node
- the node to be wrapped - must be a node in the base documentpublic boolean isTyped()
Note: in XSD 1.1 it is possible to define assertions such that the validity of a node depends on its base URI. This class assumes that no-one would be quite so perverse. The validity and type annotation of a virtual node are therefore the same as the validity and type annotation of its underlying node.
isTyped
in interface TreeInfo
isTyped
in class GenericTreeInfo
public NodeInfo selectID(java.lang.String id, boolean getParent)
selectID
in interface TreeInfo
selectID
in class GenericTreeInfo
id
- the required ID valuegetParent
- true if the required element is the parent of an element annotated as xs:ID, false
if the required node is the element itselfpublic TreeInfo getUnderlyingTree()
public java.util.function.Function<NodeInfo,java.lang.String> getBaseUriMapper()
public java.util.function.Function<NodeInfo,java.lang.String> getSystemIdMapper()
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.