public class Location
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Location.NodeFoundException
This is just a marker that the node has been found
|
static class |
Location.ReusableXMLSource |
Modifier and Type | Field and Description |
---|---|
private int |
column |
private Document |
document |
private Element |
element |
private int |
line |
private int |
lineStartOffset |
private Node |
node |
private int |
offset |
private XMLSource |
source |
Constructor and Description |
---|
Location(Document document,
Node node) |
Location(Element e) |
Location(Token token) |
Location(XMLSource source,
int offset) |
Modifier and Type | Method and Description |
---|---|
protected void |
calcLocation()
This method is called when an information is requested from the location
|
protected void |
calcLocationFromElement() |
protected void |
calcLocationFromSource()
This method is called when the location information comes from an XML source
|
int |
getColumn()
The column.
|
int |
getLine()
The line number
|
int |
getLineStartOffset()
Offset at which the current line starts in the document
|
int |
getOffset() |
protected void |
moveToOffset(XMLSource source,
int offset)
This moves the line and column information by the text found in the source.
|
protected void |
nodeNotFound()
This method is called when you specify a child node of an element
but when the location is requested, this node cannot be found.
|
java.lang.String |
toString() |
private XMLSource source
private Element element
private Document document
private Node node
private int offset
private int line
private int lineStartOffset
private int column
public Location(XMLSource source, int offset)
public Location(Element e)
public Location(Token token)
public int getOffset()
public int getLine()
public int getColumn()
public int getLineStartOffset()
protected void calcLocation()
protected void calcLocationFromSource()
protected void moveToOffset(XMLSource source, int offset)
protected void calcLocationFromElement()
protected void nodeNotFound()
By default, this method just resets the location but you can override it to throw an exception, if you like.
public java.lang.String toString()
toString
in class java.lang.Object