Class MappedDOMResource
java.lang.Object
de.wwu.scdh.annotation.selection.resource.DOMResource
de.wwu.scdh.annotation.selection.resource.MappedDOMResource
- All Implemented Interfaces:
MappedResource<net.sf.saxon.s9api.XdmNode,,net.sf.saxon.s9api.XdmValue, net.sf.saxon.s9api.XdmNode, net.sf.saxon.s9api.XdmNode> Resource<net.sf.saxon.s9api.XdmNode>,S9ApiResource<net.sf.saxon.s9api.XdmNode>
public class MappedDOMResource
extends DOMResource
implements MappedResource<net.sf.saxon.s9api.XdmNode,net.sf.saxon.s9api.XdmValue,net.sf.saxon.s9api.XdmNode,net.sf.saxon.s9api.XdmNode>
A
MappedResource mapping two DOMResources to each
other. The mapping is based on attributes and text node wrappers,
that are in libtrace.xsl and its internal
replacements.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMappedDOMResource(DOMResource preimage) Make aMappedDOMResourcefrom aDOMResourcewhich is used as the preimage.MappedDOMResource(URI uri, net.sf.saxon.s9api.XdmNode document, net.sf.saxon.s9api.Processor processor) Create a newMappedDOMResource. -
Method Summary
Modifier and TypeMethodDescriptionList<net.sf.saxon.s9api.XdmNode> getCorrespondingInImage(net.sf.saxon.s9api.XdmNode preimageNode) For a given part in the preimage, this returns the corresponding part in the image.Optional<net.sf.saxon.s9api.XdmNode> getCorrespondingInPreimage(net.sf.saxon.s9api.XdmNode imageNode) For a given part in the image, this returns the corresponding part in the preimage.getImage()Returns the image.Return anURLto a stylesheet for mapping;getNodeTrace(net.sf.saxon.s9api.XdmNode node, String xpath) Get the node ID of the given node.protected voidPrepare mapping writing node identifiers into DOM level 3 user data and setting upidToPreimageNode.protected voidMake the mappingsforwardMapandreverseMapby iterating over the items in the image, i.e., its contents, and read the DOM level 3 user data in there.voidsetImage(XdmValueResource image) Set the imageDOMResource.Methods inherited from class de.wwu.scdh.annotation.selection.resource.DOMResource
fromHTML, fromHTML, fromXML, fromXML, fromXMLwithXerces, fromXMLwithXerces, getContents, getProcessor, getUriMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.wwu.scdh.annotation.selection.Resource
getContents, getUri
-
Field Details
-
TRACKING_NAMESPACE
- See Also:
-
TRACKING_PREFIX
- See Also:
-
TRACKING_ATTRIBUTE
- See Also:
-
TRACKING_XPATH
- See Also:
-
ID_XPATH
- See Also:
-
idToPreimageNode
-
forwardMap
-
reverseMap
-
-
Constructor Details
-
MappedDOMResource
Make aMappedDOMResourcefrom aDOMResourcewhich is used as the preimage.- Throws:
ResourceException
-
MappedDOMResource
public MappedDOMResource(URI uri, net.sf.saxon.s9api.XdmNode document, net.sf.saxon.s9api.Processor processor) throws ResourceException Create a newMappedDOMResource.- Parameters:
uri- aURIidentifying the resourcedocument- the document node (root node)processor- a SaxonProcessorthat was used by the document builder- Throws:
ResourceException
-
-
Method Details
-
setImage
Set the imageDOMResource.- Throws:
ResourceException
-
getImage
Returns the image.- Specified by:
getImagein interfaceMappedResource<net.sf.saxon.s9api.XdmNode,net.sf.saxon.s9api.XdmValue, net.sf.saxon.s9api.XdmNode, net.sf.saxon.s9api.XdmNode>
-
leaveTraces
Prepare mapping writing node identifiers into DOM level 3 user data and setting upidToPreimageNode.- Throws:
ResourceException
-
readTraces
Make the mappingsforwardMapandreverseMapby iterating over the items in the image, i.e., its contents, and read the DOM level 3 user data in there.- Throws:
ResourceException
-
getCorrespondingInPreimage
public Optional<net.sf.saxon.s9api.XdmNode> getCorrespondingInPreimage(net.sf.saxon.s9api.XdmNode imageNode) For a given part in the image, this returns the corresponding part in the preimage.- Specified by:
getCorrespondingInPreimagein interfaceMappedResource<net.sf.saxon.s9api.XdmNode,net.sf.saxon.s9api.XdmValue, net.sf.saxon.s9api.XdmNode, net.sf.saxon.s9api.XdmNode>
-
getCorrespondingInImage
public List<net.sf.saxon.s9api.XdmNode> getCorrespondingInImage(net.sf.saxon.s9api.XdmNode preimageNode) For a given part in the preimage, this returns the corresponding part in the image. Since the image may contain multiple copies of the same part of the preimage, a list of parts is returned.- Specified by:
getCorrespondingInImagein interfaceMappedResource<net.sf.saxon.s9api.XdmNode,net.sf.saxon.s9api.XdmValue, net.sf.saxon.s9api.XdmNode, net.sf.saxon.s9api.XdmNode>
-
getNodeTrace
protected static Optional<String> getNodeTrace(net.sf.saxon.s9api.XdmNode node, String xpath) throws ResourceException Get the node ID of the given node.- Throws:
ResourceException
-
getMappingResource
Return anURLto a stylesheet for mapping;
-