Package net.sf.saxon.expr
Class ExpressionLocation
- java.lang.Object
-
- net.sf.saxon.expr.ExpressionLocation
-
- All Implemented Interfaces:
java.io.Serializable
,javax.xml.transform.SourceLocator
,LocationProvider
,SaxonLocator
,org.xml.sax.Locator
public class ExpressionLocation extends java.lang.Object implements SaxonLocator, java.io.Serializable
Class to hold details of the location of an expression, of an error in a source file, etc.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ExpressionLocation()
Create an ExpressionLocationExpressionLocation(java.lang.String systemId, int lineNumber, int columnNumber)
Create an ExpressionLocation corresponding to a given module, line number, and column numberExpressionLocation(javax.xml.transform.SourceLocator loc)
Create an ExpressionLocation, taking the data from a supplied JAXP SourceLocatorExpressionLocation(LocationProvider provider, long locationId)
Create an ExpressionLocation, taking the data from a supplied locationId along with a LocationProvider to interpret its meaning
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getColumnNumber()
Get the column numberint
getColumnNumber(long locationId)
Get the column number within the document or module containing a particular locationint
getLineNumber()
Get the line numberint
getLineNumber(long locationId)
Get the line number corresponding to a given location Idjava.lang.String
getPublicId()
Get the Public IDstatic SaxonLocator
getSourceLocator(long locationId, LocationProvider locationProvider)
Construct an object holding location information for a validation error messagejava.lang.String
getSystemId()
Get the system ID (the module URI)java.lang.String
getSystemId(long locationId)
Get the system Id corresponding to a given location Idstatic ExpressionLocation
makeFromSax(org.xml.sax.Locator loc)
Create an ExpressionLocation, taking the data from a supplied SAX Locatorvoid
setColumnNumber(int columnNumber)
Set the column numbervoid
setLineNumber(int lineNumber)
Set the line numbervoid
setSystemId(java.lang.String systemId)
Set the systemId (the module URI)static java.lang.String
truncateURI(java.lang.String uri)
Truncate a URI to its last component
-
-
-
Constructor Detail
-
ExpressionLocation
public ExpressionLocation()
Create an ExpressionLocation
-
ExpressionLocation
public ExpressionLocation(javax.xml.transform.SourceLocator loc)
Create an ExpressionLocation, taking the data from a supplied JAXP SourceLocator- Parameters:
loc
- the JAXP SourceLocator
-
ExpressionLocation
public ExpressionLocation(LocationProvider provider, long locationId)
Create an ExpressionLocation, taking the data from a supplied locationId along with a LocationProvider to interpret its meaning- Parameters:
provider
- the LocationProviderlocationId
- the locationId
-
ExpressionLocation
public ExpressionLocation(java.lang.String systemId, int lineNumber, int columnNumber)
Create an ExpressionLocation corresponding to a given module, line number, and column number- Parameters:
systemId
- the module URIlineNumber
- the line numbercolumnNumber
- the column number
-
-
Method Detail
-
makeFromSax
public static ExpressionLocation makeFromSax(org.xml.sax.Locator loc)
Create an ExpressionLocation, taking the data from a supplied SAX Locator- Parameters:
loc
- the SAX Locator
-
getSystemId
public java.lang.String getSystemId()
Get the system ID (the module URI)- Specified by:
getSystemId
in interfaceorg.xml.sax.Locator
- Specified by:
getSystemId
in interfacejavax.xml.transform.SourceLocator
- Returns:
- the system ID
-
getPublicId
public java.lang.String getPublicId()
Get the Public ID- Specified by:
getPublicId
in interfaceorg.xml.sax.Locator
- Specified by:
getPublicId
in interfacejavax.xml.transform.SourceLocator
- Returns:
- always null in this implementation
-
getLineNumber
public int getLineNumber()
Get the line number- Specified by:
getLineNumber
in interfaceorg.xml.sax.Locator
- Specified by:
getLineNumber
in interfacejavax.xml.transform.SourceLocator
- Returns:
- the line number
-
getColumnNumber
public int getColumnNumber()
Get the column number- Specified by:
getColumnNumber
in interfaceorg.xml.sax.Locator
- Specified by:
getColumnNumber
in interfacejavax.xml.transform.SourceLocator
- Returns:
- the column number
-
setSystemId
public void setSystemId(java.lang.String systemId)
Set the systemId (the module URI)- Parameters:
systemId
- the systemId
-
setLineNumber
public void setLineNumber(int lineNumber)
Set the line number- Parameters:
lineNumber
- the line number within the module
-
setColumnNumber
public void setColumnNumber(int columnNumber)
Set the column number- Parameters:
columnNumber
- the column number
-
getSystemId
public java.lang.String getSystemId(long locationId)
Get the system Id corresponding to a given location Id- Specified by:
getSystemId
in interfaceLocationProvider
- Parameters:
locationId
- the location Id- Returns:
- the system Id
-
getLineNumber
public int getLineNumber(long locationId)
Get the line number corresponding to a given location Id- Specified by:
getLineNumber
in interfaceLocationProvider
- Parameters:
locationId
- the location Id- Returns:
- the line number
-
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 interfaceLocationProvider
- 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
-
getSourceLocator
public static SaxonLocator getSourceLocator(long locationId, LocationProvider locationProvider)
Construct an object holding location information for a validation error message- Parameters:
locationId
- The locationId as supplied with an event such as startElement or attributelocationProvider
- The object that understands how to interpret the locationId- Returns:
- a SaxonLocator containing the location information
-
truncateURI
public static java.lang.String truncateURI(java.lang.String uri)
Truncate a URI to its last component- Parameters:
uri
- the URI to be truncated- Returns:
- the last component of the supplied URI
-
-