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 Details

  • Constructor Details

  • Method Details

    • setImage

      public void setImage(XdmValueResource image) throws ResourceException
      Set the image DOMResource.
      Throws:
      ResourceException
    • getImage

      public XdmValueResource getImage()
      Returns the image.
      Specified by:
      getImage in interface MappedResource<net.sf.saxon.s9api.XdmNode,net.sf.saxon.s9api.XdmValue,net.sf.saxon.s9api.XdmNode,net.sf.saxon.s9api.XdmNode>
    • leaveTraces

      protected void leaveTraces() throws ResourceException
      Prepare mapping writing node identifiers into DOM level 3 user data and setting up idToPreimageNode.
      Throws:
      ResourceException
    • readTraces

      protected void readTraces() throws ResourceException
      Make the mappings forwardMap and reverseMap by 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:
      getCorrespondingInPreimage in interface MappedResource<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:
      getCorrespondingInImage in interface MappedResource<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

      public URL getMappingResource()
      Return an URL to a stylesheet for mapping;