Package net.sf.saxon.trans

## Class XmlProcessingException

- java.lang.Object
- - net.sf.saxon.trans.XmlProcessingException

- All Implemented Interfaces:
    `StaticError`, `XmlProcessingError`

      public class XmlProcessingException
      extends java.lang.Object
      implements XmlProcessingError

  The XmlProcessingException class is a concrete implementation of the `XmlProcessingError` interface that wraps an `XPathException` object.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `XmlProcessingException​(XPathException exception)` | Create an XmlProcessingException wrapping an XPathException

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `XmlProcessingException` | `asWarning()` | Return an XmlProcessingError containing the same information, but to be treated as a warning condition
    `java.lang.Throwable` | `getCause()` | Return an underlying exception.
    `QName` | `getErrorCode()` | Get the error code, as a QName.
    `java.lang.String` | `getFatalErrorMessage()` | Ask whether this error is to be treated as fatal, and if so, return the relevant messsage
    `HostLanguage` | `getHostLanguage()` |
    `Location` | `getLocation()` | Get the location information associated with the error
    `java.lang.String` | `getMessage()` | Get the error message associated with this error
    `java.lang.String` | `getPath()` | Get the absolute XPath expression that identifies the node within its document where the error occurred, if available
    `XPathException` | `getXPathException()` | Get the wrapped exception
    `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.
    `void` | `setAlreadyReported​(boolean reported)` | Say whether this error has already been reported
    `void` | `setFatal​(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` | `setWarning​(boolean warning)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface net.sf.saxon.s9api.StaticError

      `getColumnNumber, getInstructionName, getLineNumber`

    - ### Methods inherited from interface net.sf.saxon.s9api.XmlProcessingError

      `getModuleUri`

- - ### Constructor Detail

    - #### XmlProcessingException

          public XmlProcessingException​(XPathException exception)

      Create an XmlProcessingException wrapping an XPathException
      Parameters:
        `exception` - the wrapped exception

  - ### Method Detail

    - #### getXPathException

          public XPathException getXPathException()

      Get the wrapped exception
      Returns:
        the wrapped exception

    - #### getHostLanguage

          public HostLanguage getHostLanguage()

      Specified by:
        `getHostLanguage` in interface `XmlProcessingError`

    - #### 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

    - #### 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 `StaticError`
      Specified by:
        `isTypeError` in interface `XmlProcessingError`
      Returns:
        true if this is a type error

    - #### getErrorCode

          public QName getErrorCode()

      Description copied from interface: `XmlProcessingError`
      Get the error code, as a QName. This may be null if no error code has been assigned
      Specified by:
        `getErrorCode` in interface `StaticError`
      Specified by:
        `getErrorCode` in interface `XmlProcessingError`
      Returns:
        QName

    - #### getMessage

          public java.lang.String getMessage()

      Description copied from interface: `XmlProcessingError`
      Get the error message associated with this error
      Specified by:
        `getMessage` in interface `StaticError`
      Specified by:
        `getMessage` in interface `XmlProcessingError`
      Returns:
        String the error message

    - #### getLocation

          public Location getLocation()

      Description copied from interface: `XmlProcessingError`
      Get the location information associated with the error
      Specified by:
        `getLocation` in interface `StaticError`
      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.

    - #### isWarning

          public boolean isWarning()

      Description copied from interface: `XmlProcessingError`
      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 `StaticError`
      Specified by:
        `isWarning` in interface `XmlProcessingError`
      Returns:
        true if a condition is detected that is not an error according to the language specification, but which may indicate that the query or stylesheet might behave in unexpected ways

    - #### getPath

          public java.lang.String getPath()

      Description copied from interface: `XmlProcessingError`
      Get the absolute XPath expression that identifies the node within its document where the error occurred, if available
      Specified by:
        `getPath` in interface `StaticError`
      Specified by:
        `getPath` in interface `XmlProcessingError`
      Returns:
        a path expression identifying the location of the error within an XML document, or null if the information is not available

    - #### getCause

          public java.lang.Throwable getCause()

      Description copied from interface: `XmlProcessingError`
      Return an underlying exception. For example, if the static error was caused by failure to retrieve another stylesheet or query module, this may contain the IO exception that was reported; or if the XML parser was unable to parse a stylesheet module, it may contain a SAXException reported by the parser.
      Specified by:
        `getCause` in interface `XmlProcessingError`
      Returns:
        the underlying exception if there was one, or null otherwise

    - #### setWarning

          public void setWarning​(boolean warning)

    - #### asWarning

          public XmlProcessingException asWarning()

      Description copied from interface: `XmlProcessingError`
      Return an XmlProcessingError containing the same information, but to be treated as a warning condition
      Specified by:
        `asWarning` in interface `XmlProcessingError`

    - #### setFatal

          public void setFatal​(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:
        `setFatal` in interface `StaticError`
      Parameters:
        `message` - an error message giving the reason for the fatal error

    - #### getFatalErrorMessage

          public java.lang.String getFatalErrorMessage()

      Ask whether this error is to be treated as fatal, and if so, return the relevant messsage
      Specified by:
        `getFatalErrorMessage` in interface `StaticError`
      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