Class XmlProcessingIncident

  • All Implemented Interfaces:
    XmlProcessingError

    public class XmlProcessingIncident
    extends java.lang.Object
    implements XmlProcessingError
    The XmlProcessingIncident class is a concrete implementation of the XmlProcessingError interface that holds all the required information internally. (That is, no exception objects are involved.)
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      XmlProcessingIncident asWarning()
      Return an XmlProcessingError containing the same information, but to be treated as a warning condition
      java.lang.Throwable getCause()
      Return the underlying exception.
      int getColumnNumber()
      The column number locating the error within a query or stylesheet module
      QName getErrorCode()
      The error code, as a QName.
      HostLanguage getHostLanguage()  
      java.lang.String getInstructionName()
      Get a name identifying the kind of instruction, in terms meaningful to a user.
      int getLineNumber()
      The line number locating the error within a query or stylesheet module
      Location getLocation()
      Get the location information associated with the error
      java.lang.String getMessage()
      Return the error message associated with this error
      java.lang.String getModuleUri()
      The URI of the query or stylesheet module in which the error was detected (as a string) May be null if the location of the error is unknown, or if the error is not localized to a specific module, or if the module in question has no known URI (for example, if it was supplied as an anonymous Stream)
      java.lang.String getPath()
      Get the absolute XPath expression that identifies the node within its document where the error occurred, if available
      java.lang.String getTerminationMessage()
      Ask whether this error is to be treated as fatal, and return the associated message
      boolean isAlreadyReported()
      Ask whether this static error has already been reported
      boolean isStaticError()
      Ask whether this is a static error, defined as an error that can be detected during static analysis of a stylesheet, query, schema, or XPath expression.
      boolean isTypeError()
      Ask whether this is a type error.
      boolean isWarning()
      Ask whether this error is being reported as a warning condition.
      static void maybeSetHostLanguage​(XmlProcessingError error, HostLanguage lang)  
      static void maybeSetLocation​(XmlProcessingError error, Location loc)  
      void setAlreadyReported​(boolean reported)
      Say whether this error has already been reported
      void setCause​(java.lang.Throwable cause)  
      void setErrorCodeAsEQName​(java.lang.String code)  
      void setHostLanguage​(HostLanguage language)  
      void setLocation​(Location loc)  
      void setStaticError​(boolean isStaticError)  
      void setTerminationMessage​(java.lang.String message)
      Indicate that this error is to be treated as fatal; that is, execution will be abandoned after reporting this error.
      void setTypeError​(boolean isTypeError)  
      void setWarning​(boolean warning)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XmlProcessingIncident

        public XmlProcessingIncident​(java.lang.String message,
                                     java.lang.String errorCode,
                                     Location location)
        Create an XmlProcessingIncident
        Parameters:
        message - the error message
        errorCode - the error code, supplied either as a local name, or in Q{uri}local format. If supplied as a local name, the standard error namespace is assumed.
        location - the location of the error
      • XmlProcessingIncident

        public XmlProcessingIncident​(java.lang.String message)
        Create an Incident
        Parameters:
        message - the error message
      • XmlProcessingIncident

        public XmlProcessingIncident​(java.lang.String message,
                                     java.lang.String errorCode)
        Create an Incident
        Parameters:
        message - the error message
        errorCode - the error code, supplied either as a local name, or in Q{uri}local format. If supplied as a local name, the standard error namespace is assumed.
      • XmlProcessingIncident

        public XmlProcessingIncident​(javax.xml.transform.TransformerException err,
                                     boolean isWarning)
    • Method Detail

      • setWarning

        public void setWarning​(boolean warning)
      • setTerminationMessage

        public void setTerminationMessage​(java.lang.String message)
        Indicate that this error is to be treated as fatal; that is, execution will be abandoned after reporting this error. This method may be called by an ErrorReporter, for example if the error is considered so severe that further processing is not worthwhile, or if too many errors have been signalled. There is no absolute guarantee that setting this property will cause execution to be abandoned. If a dynamic error is marked as fatal, it will generally not be caught by any try/catch mechanism within the stylesheet or query.
        Specified by:
        setTerminationMessage in interface XmlProcessingError
        Parameters:
        message - an error message giving the reason for the fatal error
      • getTerminationMessage

        public java.lang.String getTerminationMessage()
        Ask whether this error is to be treated as fatal, and return the associated message
        Specified by:
        getTerminationMessage in interface XmlProcessingError
        Returns:
        a non-null message if the error has been marked as a fatal error.
      • isAlreadyReported

        public boolean isAlreadyReported()
        Ask whether this static error has already been reported
        Specified by:
        isAlreadyReported in interface XmlProcessingError
        Returns:
        true if the error has already been reported
      • setAlreadyReported

        public void setAlreadyReported​(boolean reported)
        Say whether this error has already been reported
        Specified by:
        setAlreadyReported in interface XmlProcessingError
        Parameters:
        reported - true if the error has been reported
      • setHostLanguage

        public void setHostLanguage​(HostLanguage language)
      • isTypeError

        public boolean isTypeError()
        Description copied from interface: XmlProcessingError
        Ask whether this is a type error. Saxon reports type errors statically if it can establish that a supplied value will never satisfy the required type
        Specified by:
        isTypeError in interface XmlProcessingError
        Returns:
        true if this is a type error
      • setTypeError

        public void setTypeError​(boolean isTypeError)
      • isStaticError

        public boolean isStaticError()
        Description copied from interface: XmlProcessingError
        Ask whether this is a static error, defined as an error that can be detected during static analysis of a stylesheet, query, schema, or XPath expression.
        Specified by:
        isStaticError in interface XmlProcessingError
        Returns:
        true if this is a static error
      • setStaticError

        public void setStaticError​(boolean isStaticError)
      • getErrorCode

        public QName getErrorCode()
        The error code, as a QName. May be null if no error code has been assigned
        Specified by:
        getErrorCode in interface XmlProcessingError
        Returns:
        QName
      • setErrorCodeAsEQName

        public void setErrorCodeAsEQName​(java.lang.String code)
      • getMessage

        public java.lang.String getMessage()
        Return the error message associated with this error
        Specified by:
        getMessage in interface XmlProcessingError
        Returns:
        String
      • getModuleUri

        public java.lang.String getModuleUri()
        The URI of the query or stylesheet module in which the error was detected (as a string) May be null if the location of the error is unknown, or if the error is not localized to a specific module, or if the module in question has no known URI (for example, if it was supplied as an anonymous Stream)
        Specified by:
        getModuleUri in interface XmlProcessingError
        Returns:
        String
      • getLocation

        public Location getLocation()
        Description copied from interface: XmlProcessingError
        Get the location information associated with the error
        Specified by:
        getLocation in interface XmlProcessingError
        Returns:
        the location of the error. The result is never null, though it may be a location with little useful information.
      • setLocation

        public void setLocation​(Location loc)
      • getColumnNumber

        public int getColumnNumber()
        The column number locating the error within a query or stylesheet module
        Returns:
        int
      • getLineNumber

        public int getLineNumber()
        The line number locating the error within a query or stylesheet module
        Returns:
        int
      • getInstructionName

        public java.lang.String getInstructionName()
        Get a name identifying the kind of instruction, in terms meaningful to a user. This method is not used in the case where the instruction name code is a standard name (<1024).
        Returns:
        a name identifying the kind of instruction, in terms meaningful to a user. The name will always be in the form of a lexical XML QName, and should match the name used in explain() output displaying the instruction.
      • isWarning

        public boolean isWarning()
        Ask whether this error is being reported as a warning condition. If so, applications may ignore the condition, though the results may not be as intended.
        Specified by:
        isWarning in interface XmlProcessingError
        Returns:
        boolean
      • getPath

        public java.lang.String getPath()
        Get the absolute XPath expression that identifies the node within its document where the error occurred, if available
        Specified by:
        getPath in interface XmlProcessingError
        Returns:
        String - a path expression
      • getCause

        public java.lang.Throwable getCause()
        Return the underlying exception. This method may not be stable across Saxon releases.
        Specified by:
        getCause in interface XmlProcessingError
        Returns:
        the underlying exception if there was one, or null otherwise
      • setCause

        public void setCause​(java.lang.Throwable cause)