Search in sources :

Example 36 with ErrorListener

use of javax.xml.transform.ErrorListener in project j2objc by google.

the class MsgMgr method error.

/**
   * Tell the user of an error, and probably throw an
   * exception.
   *
   * @param styleNode Stylesheet node
   * @param sourceNode Source tree node
   * @param msg Message text to issue
   * @param args Arguments to use in message
   * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide
   * the error condition is severe enough to halt processing.
   *
   * @throws TransformerException
   * @xsl.usage internal
   */
public void error(SourceLocator srcLctr, Node styleNode, Node sourceNode, String msg, Object[] args) throws TransformerException {
    String formattedMsg = XSLMessages.createMessage(msg, args);
    // Locator locator = m_stylesheetLocatorStack.isEmpty()
    //                   ? null :
    //                    ((Locator)m_stylesheetLocatorStack.peek());
    // Locator locator = null;
    ErrorListener errHandler = m_transformer.getErrorListener();
    if (null != errHandler)
        errHandler.fatalError(new TransformerException(formattedMsg, srcLctr));
    else
        throw new TransformerException(formattedMsg, srcLctr);
}
Also used : ErrorListener(javax.xml.transform.ErrorListener) TransformerException(javax.xml.transform.TransformerException)

Example 37 with ErrorListener

use of javax.xml.transform.ErrorListener in project j2objc by google.

the class MsgMgr method error.

/**
   * Tell the user of an error, and probably throw an
   * exception.
   *
   * @param msg Message text to issue
   * @param args Arguments to use in message
   * @param e Exception to throw
   * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide
   * the error condition is severe enough to halt processing.
   *
   * @throws TransformerException
   * @xsl.usage internal
   */
public void error(SourceLocator srcLctr, String msg, Object[] args, Exception e) throws TransformerException {
    //msg  = (null == msg) ? XSLTErrorResources.ER_PROCESSOR_ERROR : msg;
    String formattedMsg = XSLMessages.createMessage(msg, args);
    // Locator locator = m_stylesheetLocatorStack.isEmpty()
    //                   ? null :
    //                    ((Locator)m_stylesheetLocatorStack.peek());
    // Locator locator = null;
    ErrorListener errHandler = m_transformer.getErrorListener();
    if (null != errHandler)
        errHandler.fatalError(new TransformerException(formattedMsg, srcLctr));
    else
        throw new TransformerException(formattedMsg, srcLctr);
}
Also used : ErrorListener(javax.xml.transform.ErrorListener) TransformerException(javax.xml.transform.TransformerException)

Example 38 with ErrorListener

use of javax.xml.transform.ErrorListener in project j2objc by google.

the class MsgMgr method warn.

/**
   * Warn the user of a problem.
   *
   * @param styleNode Stylesheet node
   * @param sourceNode Source tree node
   * @param msg Message text to issue
   * @param args Arguments to pass to the message
   * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide
   * the error condition is severe enough to halt processing.
   *
   * @throws TransformerException
   * @xsl.usage internal
   */
public void warn(SourceLocator srcLctr, Node styleNode, Node sourceNode, String msg, Object[] args) throws TransformerException {
    String formattedMsg = XSLMessages.createWarning(msg, args);
    ErrorListener errHandler = m_transformer.getErrorListener();
    if (null != errHandler)
        errHandler.warning(new TransformerException(formattedMsg, srcLctr));
    else
        System.out.println(formattedMsg);
}
Also used : ErrorListener(javax.xml.transform.ErrorListener) TransformerException(javax.xml.transform.TransformerException)

Example 39 with ErrorListener

use of javax.xml.transform.ErrorListener in project robovm by robovm.

the class MsgMgr method error.

/**
   * Tell the user of an error, and probably throw an
   * exception.
   *
   * @param msg Message text to issue
   * @param args Arguments to use in message
   * @param e Exception to throw
   * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide
   * the error condition is severe enough to halt processing.
   *
   * @throws TransformerException
   * @xsl.usage internal
   */
public void error(SourceLocator srcLctr, String msg, Object[] args, Exception e) throws TransformerException {
    //msg  = (null == msg) ? XSLTErrorResources.ER_PROCESSOR_ERROR : msg;
    String formattedMsg = XSLMessages.createMessage(msg, args);
    // Locator locator = m_stylesheetLocatorStack.isEmpty()
    //                   ? null :
    //                    ((Locator)m_stylesheetLocatorStack.peek());
    // Locator locator = null;
    ErrorListener errHandler = m_transformer.getErrorListener();
    if (null != errHandler)
        errHandler.fatalError(new TransformerException(formattedMsg, srcLctr));
    else
        throw new TransformerException(formattedMsg, srcLctr);
}
Also used : ErrorListener(javax.xml.transform.ErrorListener) TransformerException(javax.xml.transform.TransformerException)

Example 40 with ErrorListener

use of javax.xml.transform.ErrorListener in project robovm by robovm.

the class FuncDocument method warn.

/**
   * Warn the user of a problem.
   *
   * @param xctxt The XPath runtime state.
   * @param msg Warning message key
   * @param args Arguments to be used in the warning message
   * @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide
   * the error condition is severe enough to halt processing.
   *
   * @throws javax.xml.transform.TransformerException
   */
public void warn(XPathContext xctxt, String msg, Object[] args) throws javax.xml.transform.TransformerException {
    String formattedMsg = XSLMessages.createWarning(msg, args);
    ErrorListener errHandler = xctxt.getErrorListener();
    TransformerException spe = new TransformerException(formattedMsg, (SourceLocator) xctxt.getSAXLocator());
    if (null != errHandler)
        errHandler.warning(spe);
    else
        System.out.println(formattedMsg);
}
Also used : ErrorListener(javax.xml.transform.ErrorListener) XMLString(org.apache.xml.utils.XMLString) TransformerException(javax.xml.transform.TransformerException)

Aggregations

ErrorListener (javax.xml.transform.ErrorListener)53 TransformerException (javax.xml.transform.TransformerException)49 SAXSourceLocator (org.apache.xml.utils.SAXSourceLocator)18 XString (org.apache.xpath.objects.XString)8 Transformer (javax.xml.transform.Transformer)6 SAXException (org.xml.sax.SAXException)6 IOException (java.io.IOException)4 ExpressionVisitor (org.apache.xalan.extensions.ExpressionVisitor)4 XMLString (org.apache.xml.utils.XMLString)4 XPath (org.apache.xpath.XPath)4 OutputStream (java.io.OutputStream)2 OutputStreamWriter (java.io.OutputStreamWriter)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 Writer (java.io.Writer)2 EmptyStackException (java.util.EmptyStackException)2 SourceLocator (javax.xml.transform.SourceLocator)2 WrappedRuntimeException (org.apache.xml.serializer.utils.WrappedRuntimeException)2 XPathStylesheetDOM3Exception (org.apache.xpath.domapi.XPathStylesheetDOM3Exception)2 XObject (org.apache.xpath.objects.XObject)2