de.pdark.decentxml
Class Location

java.lang.Object
  extended by de.pdark.decentxml.Location

public class Location
extends java.lang.Object


Nested Class Summary
static class Location.NodeFoundException
          This is just a marker that the node has been found
static class Location.ReusableXMLSource
           
 
Constructor Summary
Location(Document document, Node node)
           
Location(Element e)
           
Location(Token token)
           
Location(XMLSource source, int offset)
           
 
Method Summary
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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Location

public Location(XMLSource source,
                int offset)

Location

public Location(Element e)

Location

public Location(Document document,
                Node node)

Location

public Location(Token token)
Method Detail

getOffset

public int getOffset()

getLine

public int getLine()
The line number


getColumn

public int getColumn()
The column. Tab is 8 character wide


getLineStartOffset

public int getLineStartOffset()
Offset at which the current line starts in the document


calcLocation

protected void calcLocation()
This method is called when an information is requested from the location


calcLocationFromSource

protected void calcLocationFromSource()
This method is called when the location information comes from an XML source


moveToOffset

protected void moveToOffset(XMLSource source,
                            int offset)
This moves the line and column information by the text found in the source.


calcLocationFromElement

protected void calcLocationFromElement()

nodeNotFound

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.

By default, this method just resets the location but you can override it to throw an exception, if you like.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2008-2011. All Rights Reserved.