Package net.sf.saxon.expr.parser
Class XPathParser.NestedLocation
java.lang.Object
net.sf.saxon.expr.parser.XPathParser.NestedLocation
- All Implemented Interfaces:
SourceLocator,Location,Locator
- Enclosing class:
XPathParser
A nested location: for use with XPath expressions and queries nested within some
larger document. The location information comes in two parts: the location of the query
or expression within the containing document, and the location of an error within the
query or XPath expression.
-
Constructor Summary
ConstructorsConstructorDescriptionNestedLocation(Location containingLocation, int localLineNumber, int localColumnNumber, String nearbyText) Create a NestedLocation -
Method Summary
Modifier and TypeMethodDescriptionintGet the column number of the error within the expression or queryGet the location of the container.intGet the line number within the containing entity.intGet the local line number, that is the line number relative to the start of the expression or query.Get text appearing near to the error (typically a syntax error) within the source text of the expression or query.Get the public identifier.Get the system identifier of the expression's container.Save an immutable copy of the location information.
-
Constructor Details
-
NestedLocation
public NestedLocation(Location containingLocation, int localLineNumber, int localColumnNumber, String nearbyText) Create a NestedLocation- Parameters:
containingLocation- the location of the containing construct, typically an attribute or text node in an XML documentlocalLineNumber- the line number within the containing construct, starting at zerolocalColumnNumber- the column number within the containing construct, starting at zeronearbyText- text appearing in the vicinity of the error location
-
-
Method Details
-
getContainingLocation
Get the location of the container. This is normally used for expressions nested within an XML document, where the container location gives the location of the attribute or text node holding the XPath expression as a whole- Returns:
- the location of the containing expression or query
-
getColumnNumber
public int getColumnNumber()Get the column number of the error within the expression or query- Specified by:
getColumnNumberin interfaceLocation- Specified by:
getColumnNumberin interfaceLocator- Specified by:
getColumnNumberin interfaceSourceLocator- Returns:
- the column number. This is generally maintained only during parsing, so it will be returned as -1 (meaning not available) in the case of dynamic errors. Column numbers start at 0. For expressions held within XML attributes, the position is within the attribute after XML attribute-value normalization, which replaces newlines by spaces and expands entity references.
-
getSystemId
Get the system identifier of the expression's container. This will normally be the URI of the document (or external entity) in which the expression appears.- Specified by:
getSystemIdin interfaceLocation- Specified by:
getSystemIdin interfaceLocator- Specified by:
getSystemIdin interfaceSourceLocator- Returns:
- the system identifier of the expression's container, or null if not known
-
getPublicId
Get the public identifier. This will normally be null, but is provided for compatibility with SAX and JAXP interfaces- Specified by:
getPublicIdin interfaceLocation- Specified by:
getPublicIdin interfaceLocator- Specified by:
getPublicIdin interfaceSourceLocator- Returns:
- the public identifier - usually null
-
getLocalLineNumber
public int getLocalLineNumber()Get the local line number, that is the line number relative to the start of the expression or query. For expressions held within XML attributes, the position is within the attribute after XML attribute-value normalization, which replaces newlines by spaces and expands entity references; the value will therefore in many cases not be usable. Local line numbers start at 0.- Returns:
- the local line number within the expression or query. Set to -1 if not known.
-
getLineNumber
public int getLineNumber()Get the line number within the containing entity. This is the sum of the containing location's line number, plus the local line number. Returns -1 if unknown.- Specified by:
getLineNumberin interfaceLocation- Specified by:
getLineNumberin interfaceLocator- Specified by:
getLineNumberin interfaceSourceLocator- Returns:
- the line number within the containing entity, or -1 if unknown.
-
getNearbyText
Get text appearing near to the error (typically a syntax error) within the source text of the expression or query.- Returns:
- nearby text to the error. May be null.
-
saveLocation
Save an immutable copy of the location information. This implementation does nothing, because the object is already immutable- Specified by:
saveLocationin interfaceLocation- Returns:
- immutable location information.
-