Class XMLLocation

    • Field Detail

      • UNKNOWN

        public static final XMLLocation UNKNOWN
        An unknown location.
    • Constructor Detail

      • XMLLocation

        public XMLLocation​(XMLLocation includedFrom,
                           URI uri,
                           int lineNumber,
                           int columnNumber,
                           int characterOffset,
                           String publicId,
                           String systemId)
        Construct a new instance.
        Parameters:
        includedFrom - the source location that this location was included from
        uri - the source location (may be null if not known)
        lineNumber - the line number (may be -1 if not known)
        columnNumber - the column number (may be -1 if not known)
        characterOffset - the character offset (may be -1 if not known)
        publicId - the XML public ID (may be null)
        systemId - the XML system ID (may be null)
      • XMLLocation

        public XMLLocation​(URI uri,
                           int lineNumber,
                           int columnNumber,
                           int characterOffset,
                           String publicId,
                           String systemId)
        Construct a new instance.
        Parameters:
        uri - the source location (may be null if not known)
        lineNumber - the line number (may be -1 if not known)
        columnNumber - the column number (may be -1 if not known)
        characterOffset - the character offset (may be -1 if not known)
        publicId - the XML public ID (may be null)
        systemId - the XML system ID (may be null)
      • XMLLocation

        public XMLLocation​(XMLLocation includedFrom,
                           URI uri,
                           int lineNumber,
                           int columnNumber,
                           int characterOffset)
        Construct a new instance.
        Parameters:
        includedFrom - the source location that this location was included from
        uri - the source location (may be null if not known)
        lineNumber - the line number (may be -1 if not known)
        columnNumber - the column number (may be -1 if not known)
        characterOffset - the character offset (may be -1 if not known)
      • XMLLocation

        public XMLLocation​(URI uri,
                           int lineNumber,
                           int columnNumber,
                           int characterOffset)
        Construct a new instance.
        Parameters:
        uri - the source location (may be null if not known)
        lineNumber - the line number (may be -1 if not known)
        columnNumber - the column number (may be -1 if not known)
        characterOffset - the character offset (may be -1 if not known)
      • XMLLocation

        public XMLLocation​(URI uri)
        Construct a new instance.
        Parameters:
        uri - the file name (may be null if this location does not correspond to a file)
    • Method Detail

      • getUri

        public URI getUri()
        Get the file name. May be null if this location does not correspond to a file.
        Returns:
        the file name
      • getLineNumber

        public int getLineNumber()
        Get the line number where the corresponding event ends. Returns -1 if not known.
        Specified by:
        getLineNumber in interface Location
        Returns:
        the line number where the corresponding event ends
      • getColumnNumber

        public int getColumnNumber()
        Get the column number where the corresponding event ends. Returns -1 if not known.
        Specified by:
        getColumnNumber in interface Location
        Returns:
        the column number where the corresponding event ends
      • getCharacterOffset

        public int getCharacterOffset()
        Get the absolute character offset of this event. Returns -1 if not known.
        Specified by:
        getCharacterOffset in interface Location
        Returns:
        the absolute character offset of this event
      • getPublicId

        public String getPublicId()
        Get the public ID of the XML. Returns null if not known.
        Specified by:
        getPublicId in interface Location
        Returns:
        the public ID of the XML
      • getSystemId

        public String getSystemId()
        Get the system ID of the XML. Returns null if not known.
        Specified by:
        getSystemId in interface Location
        Returns:
        the system ID of the XML
      • getIncludedFrom

        public XMLLocation getIncludedFrom()
        Get the location that this location was included from. Returns null if this was the root document.
        Returns:
        the location that this location was included from, or null
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public boolean equals​(Object other)
        Determine whether this object is equal to another.
        Overrides:
        equals in class Object
        Parameters:
        other - the other object
        Returns:
        true if they are equal, false otherwise
      • equals

        public boolean equals​(XMLLocation other)
        Determine whether this object is equal to another.
        Parameters:
        other - the other object
        Returns:
        true if they are equal, false otherwise
      • toString

        public String toString()
        Get the location as a string. The string will be suitable for immediately prefixing an error message.
        Overrides:
        toString in class Object
        Returns:
        the location as a string
      • compareTo

        public int compareTo​(XMLLocation o)
        Compare for sort.
        Specified by:
        compareTo in interface Comparable<XMLLocation>
        Parameters:
        o - the other location
        Returns:
        the sort result (-1, 0, or 1)