Interface Invalidity

  • All Superinterfaces:
    javax.xml.transform.SourceLocator
    All Known Implementing Classes:
    ValidationFailure

    public interface Invalidity
    extends javax.xml.transform.SourceLocator
    An Invalidity is a validation error, that is, a failure of the instance document to conform to the schema being used for validation.

    The class extends SourceLocator, which makes location information available (for example, a line and column number). This information will generally be the location of the error as it appears in error reports intended for a human reader. It is not necessarily the same as the location of the invalid node. For example, if the schema type for element A does not allow a child element named B, but in the instance document there is an A element with a B child, then the location information may relate to element B, whereas it is A that is invalid.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String getConstraintClauseNumber()
      Get the clause number of the rule that has been violated
      java.lang.String getConstraintName()
      Get the name of the constraint that has been violated
      java.lang.String getConstraintReference()
      Get the constraint name and clause in the format defined in XML Schema Part 1 Appendix C (Outcome Tabulations).
      AbsolutePath getContextPath()
      Get a hierarchic path giving the node being validated (the validation root).
      java.lang.String getErrorCode()
      Get the error code associated with the validity error.
      NodeInfo getInvalidNode()
      Get the node that was found to be invalid (if any).
      java.lang.String getMessage()
      Get the text of a message explaining what is wrong
      AbsolutePath getPath()
      Get a hierarchic path giving the logical position in the instance document where the validation error was found
      int getSchemaPart()
      Get the part number of the XSD schema specification containing the constraint that has been violated
      • Methods inherited from interface javax.xml.transform.SourceLocator

        getColumnNumber, getLineNumber, getPublicId, getSystemId
    • Method Detail

      • getSchemaPart

        int getSchemaPart()
        Get the part number of the XSD schema specification containing the constraint that has been violated
        Returns:
        1 (XSD part 1, structures) or 2 (XSD part 2, data types)
      • getConstraintName

        java.lang.String getConstraintName()
        Get the name of the constraint that has been violated
        Returns:
        the name of the constraint as defined in the XSD specification, for example "cvc-datatype-valid"
      • getConstraintClauseNumber

        java.lang.String getConstraintClauseNumber()
        Get the clause number of the rule that has been violated
        Returns:
        the clause number as a string, for example "3.4.1"
      • getConstraintReference

        java.lang.String getConstraintReference()
        Get the constraint name and clause in the format defined in XML Schema Part 1 Appendix C (Outcome Tabulations). This mandates the format validation-rule-name.clause-number
        Returns:
        the constraint reference, for example "cos-ct-extends.1.2"; or null if the reference is not known.
      • getInvalidNode

        NodeInfo getInvalidNode()
        Get the node that was found to be invalid (if any). This will be available only when validating an input document supplied in the form of an in-memory tree
        Returns:
        the invalid node, if it is known, or null
      • getPath

        AbsolutePath getPath()
        Get a hierarchic path giving the logical position in the instance document where the validation error was found
        Returns:
        a path to the location in the document where the error was found. This is not necessarily the same thing as the node that is invalid: for example if the schema type for element A does not allow a child element named B, but in the instance document there is an A element with a B child, then the path returned may be the path to B, whereas it is A that is invalid.
      • getContextPath

        AbsolutePath getContextPath()
        Get a hierarchic path giving the node being validated (the validation root). If validation is invoked from XSLT this might be a node selected by the instruction <xsl:copy-of select="X" validation="strict"/>; in XQuery it might be the target of a validate expression.
        Returns:
        a path to the location in the document
      • getMessage

        java.lang.String getMessage()
        Get the text of a message explaining what is wrong
        Returns:
        a human-readable message explaining the validity error
      • getErrorCode

        java.lang.String getErrorCode()
        Get the error code associated with the validity error. This is relevant only when validation is run from within XSLT or XQuery, which define different error codes for validition errors
        Returns:
        the error code associated with the error, if any. The error is returned as a simple string if it is in the standard error namespace, or as an EQName (that is Q{uri}local) otherwise.