Package net.sf.saxon.event
Class LocationCopier
- java.lang.Object
-
- net.sf.saxon.event.LocationCopier
-
- All Implemented Interfaces:
CopyInformee
,LocationProvider
,SourceLocationProvider
public class LocationCopier extends java.lang.Object implements CopyInformee, SourceLocationProvider
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.Note: prior to 9.2, the LocationCopier was a ProxyReceiver that passed all events on the pipeline unchanged. It no longer does this, instead it is found as the LocationProvider on a pipeline, but does not itself see the pipeline events.
-
-
Constructor Summary
Constructors Constructor Description LocationCopier(boolean wholeDocument)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getColumnNumber(long locationId)
Get the column number within the document, entity, or module containing a particular locationint
getLineNumber(long locationId)
Get the line number within the document, entity or module containing a particular locationjava.lang.String
getSystemId(long locationId)
Get the URI of the document, entity, or module containing a particular locationint
notifyElementNode(NodeInfo element)
Provide information about the node being copied.
-
-
-
Method Detail
-
notifyElementNode
public int 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 interfaceCopyInformee
- Parameters:
element
- the node being copied, which must be an element node- Returns:
- int a locationId to be used when referring to this element in the pipeline
-
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
-
-