Class Location

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

public class Location extends Object
  • Field Details

    • source

      private XMLSource source
    • element

      private Element element
    • document

      private Document document
    • node

      private Node node
    • offset

      private int offset
    • line

      private int line
    • lineStartOffset

      private int lineStartOffset
    • column

      private int column
  • Constructor Details

    • 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 Details

    • 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 String toString()
      Overrides:
      toString in class Object