Search in sources :

Example 1 with SAXSourceLocator

use of org.apache.xml.utils.SAXSourceLocator in project robovm by robovm.

the class StylesheetHandler method warning.

/**
   * Receive notification of a XSLT processing warning.
   *
   * @param e The warning information encoded as an exception.
   *
   * @throws org.xml.sax.SAXException that wraps a
   * {@link javax.xml.transform.TransformerException} if the current
   * {@link javax.xml.transform.ErrorListener#warning}
   * method chooses to flag this condition as an error.
   */
public void warning(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException {
    String formattedMsg = e.getMessage();
    SAXSourceLocator locator = getLocator();
    ErrorListener handler = m_stylesheetProcessor.getErrorListener();
    try {
        handler.warning(new TransformerException(formattedMsg, locator));
    } catch (TransformerException te) {
        throw new org.xml.sax.SAXException(te);
    }
}
Also used : ErrorListener(javax.xml.transform.ErrorListener) SAXSourceLocator(org.apache.xml.utils.SAXSourceLocator) TransformerException(javax.xml.transform.TransformerException)

Example 2 with SAXSourceLocator

use of org.apache.xml.utils.SAXSourceLocator in project robovm by robovm.

the class StylesheetHandler method error.

/**
   * Tell the user of an error, and probably throw an
   * exception.
   *
   * @param msg An error message.
   * @param e An error which the SAXException should wrap.
   *
   * @throws org.xml.sax.SAXException that wraps a
   * {@link javax.xml.transform.TransformerException} if the current
   * {@link javax.xml.transform.ErrorListener#error}
   * method chooses to flag this condition as an error.
   * @xsl.usage internal
   */
protected void error(String msg, Exception e) throws org.xml.sax.SAXException {
    SAXSourceLocator locator = getLocator();
    ErrorListener handler = m_stylesheetProcessor.getErrorListener();
    TransformerException pe;
    if (!(e instanceof TransformerException)) {
        pe = (null == e) ? new TransformerException(msg, locator) : new TransformerException(msg, locator, e);
    } else
        pe = (TransformerException) e;
    if (null != handler) {
        try {
            handler.error(pe);
        } catch (TransformerException te) {
            throw new org.xml.sax.SAXException(te);
        }
    } else
        throw new org.xml.sax.SAXException(pe);
}
Also used : ErrorListener(javax.xml.transform.ErrorListener) SAXSourceLocator(org.apache.xml.utils.SAXSourceLocator) TransformerException(javax.xml.transform.TransformerException)

Example 3 with SAXSourceLocator

use of org.apache.xml.utils.SAXSourceLocator in project j2objc by google.

the class StylesheetHandler method getLocator.

/**
   * Get the current stylesheet Locator object.
   *
   * @return non-null reference to the current locator object.
   */
public SAXSourceLocator getLocator() {
    if (m_stylesheetLocatorStack.isEmpty()) {
        SAXSourceLocator locator = new SAXSourceLocator();
        locator.setSystemId(this.getStylesheetProcessor().getDOMsystemID());
        return locator;
    // m_stylesheetLocatorStack.push(locator);
    }
    return ((SAXSourceLocator) m_stylesheetLocatorStack.peek());
}
Also used : SAXSourceLocator(org.apache.xml.utils.SAXSourceLocator)

Example 4 with SAXSourceLocator

use of org.apache.xml.utils.SAXSourceLocator in project j2objc by google.

the class StylesheetHandler method fatalError.

/**
   * Report a fatal XSLT processing error.
   *
   * @param e The error information encoded as an exception.
   *
   * @throws org.xml.sax.SAXException that wraps a
   * {@link javax.xml.transform.TransformerException} if the current
   * {@link javax.xml.transform.ErrorListener#fatalError}
   * method chooses to flag this condition as an error.
   */
public void fatalError(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException {
    String formattedMsg = e.getMessage();
    SAXSourceLocator locator = getLocator();
    ErrorListener handler = m_stylesheetProcessor.getErrorListener();
    try {
        handler.fatalError(new TransformerException(formattedMsg, locator));
    } catch (TransformerException te) {
        throw new org.xml.sax.SAXException(te);
    }
}
Also used : ErrorListener(javax.xml.transform.ErrorListener) SAXSourceLocator(org.apache.xml.utils.SAXSourceLocator) TransformerException(javax.xml.transform.TransformerException)

Example 5 with SAXSourceLocator

use of org.apache.xml.utils.SAXSourceLocator in project j2objc by google.

the class StylesheetHandler method warning.

/**
   * Receive notification of a XSLT processing warning.
   *
   * @param e The warning information encoded as an exception.
   *
   * @throws org.xml.sax.SAXException that wraps a
   * {@link javax.xml.transform.TransformerException} if the current
   * {@link javax.xml.transform.ErrorListener#warning}
   * method chooses to flag this condition as an error.
   */
public void warning(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException {
    String formattedMsg = e.getMessage();
    SAXSourceLocator locator = getLocator();
    ErrorListener handler = m_stylesheetProcessor.getErrorListener();
    try {
        handler.warning(new TransformerException(formattedMsg, locator));
    } catch (TransformerException te) {
        throw new org.xml.sax.SAXException(te);
    }
}
Also used : ErrorListener(javax.xml.transform.ErrorListener) SAXSourceLocator(org.apache.xml.utils.SAXSourceLocator) TransformerException(javax.xml.transform.TransformerException)

Aggregations

SAXSourceLocator (org.apache.xml.utils.SAXSourceLocator)24 TransformerException (javax.xml.transform.TransformerException)22 ErrorListener (javax.xml.transform.ErrorListener)18 ElemTemplateElement (org.apache.xalan.templates.ElemTemplateElement)4 Stylesheet (org.apache.xalan.templates.Stylesheet)4 IOException (java.io.IOException)2 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)2 SourceLocator (javax.xml.transform.SourceLocator)2 TransformerConfigurationException (javax.xml.transform.TransformerConfigurationException)2 ElemExtensionCall (org.apache.xalan.templates.ElemExtensionCall)2 ElemLiteralResult (org.apache.xalan.templates.ElemLiteralResult)2 ElemTemplate (org.apache.xalan.templates.ElemTemplate)2 StylesheetComposed (org.apache.xalan.templates.StylesheetComposed)2 StylesheetRoot (org.apache.xalan.templates.StylesheetRoot)2 DTM (org.apache.xml.dtm.DTM)2 DTMIterator (org.apache.xml.dtm.DTMIterator)2 XPath (org.apache.xpath.XPath)2 XPathContext (org.apache.xpath.XPathContext)2 XString (org.apache.xpath.objects.XString)2 Locator (org.xml.sax.Locator)2