Class Loc

java.lang.Object
net.sf.saxon.expr.parser.Loc
All Implemented Interfaces:
SourceLocator, Location, Locator

public class Loc extends 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.
  • Field Details

    • NONE

      public static Loc NONE
  • Constructor Details

    • Loc

      public Loc(SourceLocator loc)
      Create an ExpressionLocation, taking the data from a supplied JAXP SourceLocator
      Parameters:
      loc - the JAXP SourceLocator
    • Loc

      public Loc(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 (starting at 1; -1 means unknown)
      columnNumber - the column number (starting at 1; -1 means unknown)
  • Method Details

    • getSystemId

      public String getSystemId()
      Get the system ID (the module URI)
      Specified by:
      getSystemId in interface Location
      Specified by:
      getSystemId in interface Locator
      Specified by:
      getSystemId in interface SourceLocator
      Returns:
      the system ID
    • getPublicId

      public String getPublicId()
      Get the Public ID
      Specified by:
      getPublicId in interface Location
      Specified by:
      getPublicId in interface Locator
      Specified by:
      getPublicId in interface SourceLocator
      Returns:
      always null in this implementation
    • getLineNumber

      public int getLineNumber()
      Get the line number
      Specified by:
      getLineNumber in interface Location
      Specified by:
      getLineNumber in interface Locator
      Specified by:
      getLineNumber in interface SourceLocator
      Returns:
      the line number
    • getColumnNumber

      public int getColumnNumber()
      Get the column number
      Specified by:
      getColumnNumber in interface Location
      Specified by:
      getColumnNumber in interface Locator
      Specified by:
      getColumnNumber in interface 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 interface Location
      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"