Interface Located

  • All Known Implementing Classes:
    LocatedCDATA, LocatedComment, LocatedDocType, LocatedElement, LocatedEntityRef, LocatedProcessingInstruction, LocatedText

    public interface Located
    Implementations of this class know about their location (line and column).

    While it would seem intuitive that this represents the location where the content starts, in fact, if the data is populated by a SAX parser the line and column values represent the end of the SAX event.

    SAX parsers may vary, but it typically means the character after the last character for Text and CDATA values, the character after EntityRef, Comment, and ProcessingInstruction data, and the character after the opening tag for Element content. For DocType content, it appears that Xerces is inconsistent in the location, with the location being set at what appears to be the start of the internal subset data (if any).

    Finally, remember that the column value counts characters, and thus, if you have tab-indented values, the tab counts as a single character (regardless of how much it indents).

    Author:
    Rolf Lear
    • Method Detail

      • getLine

        int getLine()
        Get the line number
        Returns:
        the line number
      • getColumn

        int getColumn()
        Get the column (character on the line).
        Returns:
        the column
      • setLine

        void setLine​(int line)
        Set the line number
        Parameters:
        line - the line.
      • setColumn

        void setColumn​(int col)
        Set the column (character on the line).
        Parameters:
        col - The column