Search in sources :

Example 1 with XPathStylesheetDOM3Exception

use of org.apache.xpath.domapi.XPathStylesheetDOM3Exception in project j2objc by google.

the class XPathParser method errorForDOM3.

/**
   * This method is added to support DOM 3 XPath API.
   * <p>
   * This method is exactly like error(String, Object[]); except that
   * the underlying TransformerException is 
   * XpathStylesheetDOM3Exception (which extends TransformerException).
   * <p>
   * So older XPath code in Xalan is not affected by this. To older XPath code
   * the behavior of whether error() or errorForDOM3() is called because it is
   * always catching TransformerException objects and is oblivious to
   * the new subclass of XPathStylesheetDOM3Exception. Older XPath code 
   * runs as before.
   * <p>
   * However, newer DOM3 XPath code upon catching a TransformerException can
   * can check if the exception is an instance of XPathStylesheetDOM3Exception
   * and take appropriate action.
   * 
   * @param msg An error msgkey that corresponds to one of the constants found 
   *            in {@link org.apache.xpath.res.XPATHErrorResources}, which is 
   *            a key for a format string.
   * @param args An array of arguments represented in the format string, which 
   *             may be null.
   *
   * @throws TransformerException if the current ErrorListoner determines to 
   *                              throw an exception.
   */
void errorForDOM3(String msg, Object[] args) throws TransformerException {
    String fmsg = XSLMessages.createXPATHMessage(msg, args);
    ErrorListener ehandler = this.getErrorListener();
    TransformerException te = new XPathStylesheetDOM3Exception(fmsg, m_sourceLocator);
    if (null != ehandler) {
        // TO DO: Need to get stylesheet Locator from here.
        ehandler.fatalError(te);
    } else {
        // System.err.println(fmsg);
        throw te;
    }
}
Also used : ErrorListener(javax.xml.transform.ErrorListener) XPathStylesheetDOM3Exception(org.apache.xpath.domapi.XPathStylesheetDOM3Exception) XString(org.apache.xpath.objects.XString) TransformerException(javax.xml.transform.TransformerException)

Example 2 with XPathStylesheetDOM3Exception

use of org.apache.xpath.domapi.XPathStylesheetDOM3Exception in project robovm by robovm.

the class XPathParser method errorForDOM3.

/**
   * This method is added to support DOM 3 XPath API.
   * <p>
   * This method is exactly like error(String, Object[]); except that
   * the underlying TransformerException is 
   * XpathStylesheetDOM3Exception (which extends TransformerException).
   * <p>
   * So older XPath code in Xalan is not affected by this. To older XPath code
   * the behavior of whether error() or errorForDOM3() is called because it is
   * always catching TransformerException objects and is oblivious to
   * the new subclass of XPathStylesheetDOM3Exception. Older XPath code 
   * runs as before.
   * <p>
   * However, newer DOM3 XPath code upon catching a TransformerException can
   * can check if the exception is an instance of XPathStylesheetDOM3Exception
   * and take appropriate action.
   * 
   * @param msg An error msgkey that corresponds to one of the constants found 
   *            in {@link org.apache.xpath.res.XPATHErrorResources}, which is 
   *            a key for a format string.
   * @param args An array of arguments represented in the format string, which 
   *             may be null.
   *
   * @throws TransformerException if the current ErrorListoner determines to 
   *                              throw an exception.
   */
void errorForDOM3(String msg, Object[] args) throws TransformerException {
    String fmsg = XSLMessages.createXPATHMessage(msg, args);
    ErrorListener ehandler = this.getErrorListener();
    TransformerException te = new XPathStylesheetDOM3Exception(fmsg, m_sourceLocator);
    if (null != ehandler) {
        // TO DO: Need to get stylesheet Locator from here.
        ehandler.fatalError(te);
    } else {
        // System.err.println(fmsg);
        throw te;
    }
}
Also used : ErrorListener(javax.xml.transform.ErrorListener) XPathStylesheetDOM3Exception(org.apache.xpath.domapi.XPathStylesheetDOM3Exception) XString(org.apache.xpath.objects.XString) TransformerException(javax.xml.transform.TransformerException)

Aggregations

ErrorListener (javax.xml.transform.ErrorListener)2 TransformerException (javax.xml.transform.TransformerException)2 XPathStylesheetDOM3Exception (org.apache.xpath.domapi.XPathStylesheetDOM3Exception)2 XString (org.apache.xpath.objects.XString)2