Class DOMSender

  • All Implemented Interfaces:
    javax.xml.transform.SourceLocator, LocationProvider, SaxonLocator, SourceLocationProvider, org.xml.sax.Locator

    public class DOMSender
    extends java.lang.Object
    implements SaxonLocator, SourceLocationProvider
    DOMSender.java: pseudo-SAX driver for a DOM source document. This class takes an existing DOM Document and walks around it in a depth-first traversal, calling a Receiver to process the nodes as it does so
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.w3c.dom.Node root  
      protected java.lang.String systemId  
    • Constructor Summary

      Constructors 
      Constructor Description
      DOMSender()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getColumnNumber()  
      int getColumnNumber​(long locationId)
      Get the column number within the document or module containing a particular location
      int getLineNumber()  
      int getLineNumber​(long locationId)
      Get the line number within the document or module containing a particular location
      java.lang.String getPublicId()  
      java.lang.String getSystemId()  
      java.lang.String getSystemId​(long locationId)
      Get the URI of the document or module containing a particular location
      void send()
      Walk a document (traversing the nodes depth first)
      void setPipelineConfiguration​(PipelineConfiguration pipe)
      Set the pipeline configuration
      void setReceiver​(Receiver receiver)
      Set the receiver.
      void setStartNode​(org.w3c.dom.Node start)
      Set the DOM Document that will be walked
      void setSystemId​(java.lang.String systemId)
      Set the systemId of the source document (which will also be used for the destination)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • root

        protected org.w3c.dom.Node root
      • systemId

        protected java.lang.String systemId
    • Constructor Detail

      • DOMSender

        public DOMSender()
    • Method Detail

      • setPipelineConfiguration

        public void setPipelineConfiguration​(PipelineConfiguration pipe)
        Set the pipeline configuration
        Parameters:
        pipe - the pipeline configuration
      • setReceiver

        public void setReceiver​(Receiver receiver)
        Set the receiver.
        Parameters:
        receiver - The object to receive content events.
      • setStartNode

        public void setStartNode​(org.w3c.dom.Node start)
        Set the DOM Document that will be walked
        Parameters:
        start - the root node from which the tree walk will start
      • setSystemId

        public void setSystemId​(java.lang.String systemId)
        Set the systemId of the source document (which will also be used for the destination)
        Parameters:
        systemId - the systemId of the source document
      • send

        public void send()
                  throws XPathException
        Walk a document (traversing the nodes depth first)
        Throws:
        XPathException - On any error in the document
      • getColumnNumber

        public int getColumnNumber()
        Specified by:
        getColumnNumber in interface org.xml.sax.Locator
        Specified by:
        getColumnNumber in interface javax.xml.transform.SourceLocator
      • getLineNumber

        public int getLineNumber()
        Specified by:
        getLineNumber in interface org.xml.sax.Locator
        Specified by:
        getLineNumber in interface javax.xml.transform.SourceLocator
      • getPublicId

        public java.lang.String getPublicId()
        Specified by:
        getPublicId in interface org.xml.sax.Locator
        Specified by:
        getPublicId in interface javax.xml.transform.SourceLocator
      • getSystemId

        public java.lang.String getSystemId()
        Specified by:
        getSystemId in interface org.xml.sax.Locator
        Specified by:
        getSystemId in interface javax.xml.transform.SourceLocator
      • getSystemId

        public java.lang.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