net.sf.saxon.expr
Class ExpressionLocation

java.lang.Object
  extended by net.sf.saxon.expr.ExpressionLocation
All Implemented Interfaces:
Serializable, SourceLocator, LocationProvider, SaxonLocator, Locator

public class ExpressionLocation
extends Object
implements SaxonLocator, 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
ExpressionLocation()
          Create an ExpressionLocation
ExpressionLocation(LocationProvider provider, long locationId)
          Create an ExpressionLocation, taking the data from a supplied locationId along with a LocationProvider to interpret its meaning
ExpressionLocation(SourceLocator loc)
          Create an ExpressionLocation, taking the data from a supplied JAXP SourceLocator
ExpressionLocation(String systemId, int lineNumber, int columnNumber)
          Create an ExpressionLocation corresponding to a given module, line number, and column number
 
Method Summary
 int getColumnNumber()
          Get the column number
 int getColumnNumber(long locationId)
          Get the column number within the document, entity, or module containing a particular location
 int getLineNumber()
          Get the line number
 int getLineNumber(long locationId)
          Get the line number corresponding to a given location Id
 String getPublicId()
          Get the Public ID
static SaxonLocator getSourceLocator(long locationId, LocationProvider locationProvider)
          Construct an object holding location information for a validation error message
 String getSystemId()
          Get the system ID (the module URI)
 String getSystemId(long locationId)
          Get the system Id corresponding to a given location Id
static ExpressionLocation makeFromSax(Locator loc)
          Create an ExpressionLocation, taking the data from a supplied SAX Locator
 void setColumnNumber(int columnNumber)
          Set the column number
 void setLineNumber(int lineNumber)
          Set the line number
 void setSystemId(String systemId)
          Set the systemId (the module URI)
static String truncateURI(String uri)
          Truncate a URI to its last component
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpressionLocation

public ExpressionLocation()
Create an ExpressionLocation


ExpressionLocation

public ExpressionLocation(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 LocationProvider
locationId - the locationId

ExpressionLocation

public ExpressionLocation(String systemId,
                          int lineNumber,
                          int columnNumber)
Create an ExpressionLocation corresponding to a given module, line number, and column number

Parameters:
systemId - the module URI
lineNumber - the line number
columnNumber - the column number
Method Detail

makeFromSax

public static ExpressionLocation makeFromSax(Locator loc)
Create an ExpressionLocation, taking the data from a supplied SAX Locator

Parameters:
loc - the SAX Locator

getSystemId

public String getSystemId()
Get the system ID (the module URI)

Specified by:
getSystemId in interface SourceLocator
Specified by:
getSystemId in interface Locator
Returns:
the system ID

getPublicId

public String getPublicId()
Get the Public ID

Specified by:
getPublicId in interface SourceLocator
Specified by:
getPublicId in interface Locator
Returns:
always null in this implementation

getLineNumber

public int getLineNumber()
Get the line number

Specified by:
getLineNumber in interface SourceLocator
Specified by:
getLineNumber in interface Locator
Returns:
the line number

getColumnNumber

public int getColumnNumber()
Get the column number

Specified by:
getColumnNumber in interface SourceLocator
Specified by:
getColumnNumber in interface Locator
Returns:
the column number

setSystemId

public void setSystemId(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 String getSystemId(long locationId)
Get the system Id corresponding to a given location Id

Specified by:
getSystemId in interface LocationProvider
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 interface LocationProvider
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, entity, 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, entity, 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 attribute
locationProvider - The object that understands how to interpret the locationId
Returns:
a SaxonLocator containing the location information

truncateURI

public static String truncateURI(String uri)
Truncate a URI to its last component

Parameters:
uri - the URI to be truncated
Returns:
the last component of the supplied URI


Copyright (c) Saxonica Limited. All rights reserved.