Package net.sf.saxon.dom
Class DOMSender
- java.lang.Object
-
- net.sf.saxon.dom.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
-
-
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, entity, or module containing a particular locationint
getLineNumber()
int
getLineNumber(long locationId)
Get the line number within the document, entity or module containing a particular locationjava.lang.String
getPublicId()
java.lang.String
getSystemId()
java.lang.String
getSystemId(long locationId)
Get the URI of the document, entity, or module containing a particular locationvoid
send()
Walk a tree (traversing the nodes depth first).void
setSystemId(java.lang.String systemId)
Set the systemId of the source document (which will also be used for the destination)
-
-
-
Constructor Detail
-
DOMSender
public DOMSender(org.w3c.dom.Node startNode, Receiver receiver)
Create a DOMSender that will send events representing the nodes in a tree to a nominated receiver- Parameters:
startNode
- the root node of the tree to be send. Usually a document or element node.receiver
- the object to be notified of the resulting events. The supplied Receiver must be initialized with a PipelineConfiguration.The PipelineConfiguration of the Receiver will be modified to set this DOMSender as its LocationProvider.
-
-
Method Detail
-
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 tree (traversing the nodes depth first).- Throws:
java.lang.IllegalStateException
- if the start node is of a node kind other than document, document fragment, element, text, comment, or processing instruction (for example, if it is an attribute node).XPathException
- On any error in the document
-
getColumnNumber
public int getColumnNumber()
- Specified by:
getColumnNumber
in interfaceorg.xml.sax.Locator
- Specified by:
getColumnNumber
in interfacejavax.xml.transform.SourceLocator
-
getLineNumber
public int getLineNumber()
- Specified by:
getLineNumber
in interfaceorg.xml.sax.Locator
- Specified by:
getLineNumber
in interfacejavax.xml.transform.SourceLocator
-
getPublicId
public java.lang.String getPublicId()
- Specified by:
getPublicId
in interfaceorg.xml.sax.Locator
- Specified by:
getPublicId
in interfacejavax.xml.transform.SourceLocator
-
getSystemId
public java.lang.String getSystemId()
- Specified by:
getSystemId
in interfaceorg.xml.sax.Locator
- Specified by:
getSystemId
in interfacejavax.xml.transform.SourceLocator
-
getSystemId
public java.lang.String getSystemId(long locationId)
Description copied from interface:LocationProvider
Get the URI of the document, entity, or module containing a particular location- Specified by:
getSystemId
in interfaceLocationProvider
- Parameters:
locationId
- identifier of the location in question (as passed down the Receiver pipeline)- Returns:
- the URI of the document, XML entity or module. For a SourceLocationProvider this will be the URI of the document or entity (the URI that would be the base URI if there were no xml:base attributes). In other cases it may identify the query or stylesheet module currently being executed.
-
getLineNumber
public int getLineNumber(long locationId)
Description copied from interface:LocationProvider
Get the line number within the document, entity or module containing a particular location- Specified by:
getLineNumber
in interfaceLocationProvider
- Parameters:
locationId
- identifier of the location in question (as passed down the Receiver pipeline)- Returns:
- the line number within the document, entity or module, or -1 if no information is available.
-
getColumnNumber
public int getColumnNumber(long locationId)
Description copied from interface:LocationProvider
Get the column number within the document, entity, or module containing a particular location- Specified by:
getColumnNumber
in interfaceLocationProvider
- Parameters:
locationId
- identifier of the location in question (as passed down the Receiver pipeline)- Returns:
- the column number within the document, entity, or module, or -1 if this is not available
-
-