Package net.sf.saxon.expr.parser
Class Loc
java.lang.Object
net.sf.saxon.expr.parser.Loc
- All Implemented Interfaces:
SourceLocator
,Location
,Locator
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.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate an ExpressionLocation corresponding to a given module, line number, and column numberLoc
(SourceLocator loc) Create an ExpressionLocation, taking the data from a supplied JAXP SourceLocator -
Method Summary
Modifier and TypeMethodDescriptionint
Get the column numberint
Get the line numberGet the Public IDGet the system ID (the module URI)static boolean
Ask whether this is an "unknown location"Get an immutable copy of this Location object.
-
Field Details
-
NONE
-
-
Constructor Details
-
Loc
Create an ExpressionLocation, taking the data from a supplied JAXP SourceLocator- Parameters:
loc
- the JAXP SourceLocator
-
Loc
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 Details
-
getSystemId
Get the system ID (the module URI)- Specified by:
getSystemId
in interfaceLocation
- Specified by:
getSystemId
in interfaceLocator
- Specified by:
getSystemId
in interfaceSourceLocator
- Returns:
- the system ID
-
getPublicId
Get the Public ID- Specified by:
getPublicId
in interfaceLocation
- Specified by:
getPublicId
in interfaceLocator
- Specified by:
getPublicId
in interfaceSourceLocator
- Returns:
- always null in this implementation
-
getLineNumber
public int getLineNumber()Get the line number- Specified by:
getLineNumber
in interfaceLocation
- Specified by:
getLineNumber
in interfaceLocator
- Specified by:
getLineNumber
in interfaceSourceLocator
- Returns:
- the line number
-
getColumnNumber
public int getColumnNumber()Get the column number- Specified by:
getColumnNumber
in interfaceLocation
- Specified by:
getColumnNumber
in interfaceLocator
- Specified by:
getColumnNumber
in interfaceSourceLocator
- Returns:
- the column number
-
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
Ask whether this is an "unknown location"- Parameters:
location
- a location- Returns:
- true if this is an "unknown location"
-