Class InputPosition

  • All Implemented Interfaces:
    Position

    class InputPosition
    extends java.lang.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 source
      This is the XML event that the position is acquired for.
    • Constructor Summary

      Constructors 
      Constructor Description
      InputPosition​(EventNode source)
      Constructor for the InputPosition object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getLine()
      This is the actual line number within the read XML document.
      java.lang.String toString()
      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 Detail

      • source

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

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

      • 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 java.lang.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 java.lang.Object
        Returns:
        this returns a textual description of the position