Class LocationCopier

All Implemented Interfaces:
Result, CopyInformee, LocationProvider, Receiver

public class LocationCopier extends ProxyReceiver implements CopyInformee, LocationProvider
A Receiver that can be inserted into an event pipeline to copy location information. The class acts as a LocationProvider, so it supports getSystemId() and getLineNumber() methods; the location returned can vary for each node, and is set by the class generating the events. The class is used when it is necessary to copy a subtree along with its location information; for example, when copying an inline schema within a stylesheet to a separate schema document.
  • Constructor Details

    • LocationCopier

      public LocationCopier()
    • LocationCopier

      public LocationCopier(Receiver nextReceiver)
  • Method Details

    • setPipelineConfiguration

      public void setPipelineConfiguration(PipelineConfiguration pipe)
      Description copied from interface: Receiver
      Set the pipeline configuration
      Specified by:
      setPipelineConfiguration in interface Receiver
      Overrides:
      setPipelineConfiguration in class ProxyReceiver
      Parameters:
      pipe - the pipeline configuration
    • notifyElementNode

      public void notifyElementNode(NodeInfo element)
      Provide information about the node being copied. This method is called immediately before the startElement call for the element node in question.
      Specified by:
      notifyElementNode in interface CopyInformee
      Parameters:
      element - the node being copied, which must be an element node
    • getLineNumber

      public int getLineNumber()
      Get the line number
      Returns:
      the line number most recently set
    • getSystemId

      public String getSystemId(long locationId)
      Description copied from interface: LocationProvider
      Get the URI of the document or module containing a particular location
      Specified by:
      getSystemId in interface LocationProvider
      Parameters:
      locationId - identifier of the location in question (as passed down the Receiver pipeline)
      Returns:
      the URI of the document or module.
    • getLineNumber

      public int getLineNumber(long locationId)
      Description copied from interface: LocationProvider
      Get the line number within the document or module containing a particular location
      Specified by:
      getLineNumber in interface LocationProvider
      Parameters:
      locationId - identifier of the location in question (as passed down the Receiver pipeline)
      Returns:
      the line number within the document or module.
    • getColumnNumber

      public int getColumnNumber(long locationId)
      Description copied from interface: LocationProvider
      Get the column number within the document or module containing a particular location
      Specified by:
      getColumnNumber in interface LocationProvider
      Parameters:
      locationId - identifier of the location in question (as passed down the Receiver pipeline)
      Returns:
      the column number within the document or module, or -1 if this is not available