Class InputPosition

java.lang.Object
org.simpleframework.xml.stream.InputPosition
All Implemented Interfaces:
Position

class InputPosition extends Object implements Position
The InputPosition object is used to acquire the line number within the XML document. This allows debugging to be done when a problem occurs with the source document. This object can be converted to a string using the toString method.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private EventNode
    This is the XML event that the position is acquired for.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor for the InputPosition object.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    This is the actual line number within the read XML document.
    This provides a textual description of the position the read cursor is at within the XML document.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • source

      private EventNode source
      This is the XML event that the position is acquired for.
  • Constructor Details

    • InputPosition

      public InputPosition(EventNode source)
      Constructor for the InputPosition object. This is used to create a position description if the provided event is not null. This will return -1 if the specified event does not provide any location information.
      Parameters:
      source - this is the XML event to get the position of
  • Method Details

    • getLine

      public int getLine()
      This is the actual line number within the read XML document. The line number allows any problems within the source XML document to be debugged if it does not match the schema. This will return -1 if the line number cannot be determined.
      Specified by:
      getLine in interface Position
      Returns:
      this returns the line number of an XML event
    • toString

      public String toString()
      This provides a textual description of the position the read cursor is at within the XML document. This allows the position to be embedded within the exception thrown.
      Specified by:
      toString in interface Position
      Overrides:
      toString in class Object
      Returns:
      this returns a textual description of the position