Package net.sf.saxon.expr.parser
Class Loc
- java.lang.Object
-
- net.sf.saxon.expr.parser.Loc
-
- All Implemented Interfaces:
javax.xml.transform.SourceLocator
,Location
,org.xml.sax.Locator
public class Loc extends java.lang.Object implements Location
Class to hold details of the location of an expression, of an error in a source file, etc. The object is immutable. Previous names: ExpressionLocation, ExplicitLocation.
-
-
Constructor Summary
Constructors Constructor Description Loc(java.lang.String systemId, int lineNumber, int columnNumber)
Create an ExpressionLocation corresponding to a given module, line number, and column numberLoc(javax.xml.transform.SourceLocator loc)
Create an ExpressionLocation, taking the data from a supplied JAXP SourceLocator
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getColumnNumber()
Get the column numberint
getLineNumber()
Get the line numberjava.lang.String
getPublicId()
Get the Public IDjava.lang.String
getSystemId()
Get the system ID (the module URI)static boolean
isUnknown(Location location)
Ask whether this is an "unknown location"static Loc
makeFromSax(org.xml.sax.Locator loc)
Create an ExpressionLocation, taking the data from a supplied SAX LocatorLocation
saveLocation()
Get an immutable copy of this Location object.
-
-
-
Field Detail
-
NONE
public static Loc NONE
-
-
Constructor Detail
-
Loc
public Loc(javax.xml.transform.SourceLocator loc)
Create an ExpressionLocation, taking the data from a supplied JAXP SourceLocator- Parameters:
loc
- the JAXP SourceLocator
-
Loc
public Loc(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 number (starting at 1; -1 means unknown)columnNumber
- the column number (starting at 1; -1 means unknown)
-
-
Method Detail
-
makeFromSax
public static Loc makeFromSax(org.xml.sax.Locator loc)
Create an ExpressionLocation, taking the data from a supplied SAX Locator- Parameters:
loc
- the SAX Locator- Returns:
- the ExpressionLocation
-
getSystemId
public java.lang.String getSystemId()
Get the system ID (the module URI)- Specified by:
getSystemId
in interfaceLocation
- 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 interfaceLocation
- 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 interfaceLocation
- 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 interfaceLocation
- Specified by:
getColumnNumber
in interfaceorg.xml.sax.Locator
- Specified by:
getColumnNumber
in interfacejavax.xml.transform.SourceLocator
- Returns:
- the column number
-
saveLocation
public Location saveLocation()
Get an immutable copy of this Location object. By default Location objects may be mutable, so they should not be saved for later use. The result of this operation holds the same location information, but in an immutable form.- Specified by:
saveLocation
in interfaceLocation
- Returns:
- an immutable copy (which may be the original object, if it is already immutable)
-
isUnknown
public static boolean isUnknown(Location location)
Ask whether this is an "unknown location"- Parameters:
location
- a location- Returns:
- true if this is an "unknown location"
-
-