use of javax.xml.transform.ErrorListener in project robovm by robovm.
the class Expression method error.
/**
* Tell the user of an error, and probably throw an
* exception.
*
* @param xctxt The XPath runtime context.
* @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.
*
* @throws javax.xml.transform.TransformerException
*/
public void error(XPathContext xctxt, String msg, Object[] args) throws javax.xml.transform.TransformerException {
java.lang.String fmsg = XSLMessages.createXPATHMessage(msg, args);
if (null != xctxt) {
ErrorListener eh = xctxt.getErrorListener();
TransformerException te = new TransformerException(fmsg, this);
eh.fatalError(te);
}
}
use of javax.xml.transform.ErrorListener in project robovm by robovm.
the class Expression method warn.
/**
* Warn the user of an problem.
*
* @param xctxt The XPath runtime context.
* @param msg An error msgkey that corresponds to one of the conststants 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.
*
* @throws javax.xml.transform.TransformerException
*/
public void warn(XPathContext xctxt, String msg, Object[] args) throws javax.xml.transform.TransformerException {
java.lang.String fmsg = XSLMessages.createXPATHWarning(msg, args);
if (null != xctxt) {
ErrorListener eh = xctxt.getErrorListener();
// TO DO: Need to get stylesheet Locator from here.
eh.warning(new TransformerException(fmsg, xctxt.getSAXLocator()));
}
}
use of javax.xml.transform.ErrorListener in project j2objc by google.
the class Expression method error.
/**
* Tell the user of an error, and probably throw an
* exception.
*
* @param xctxt The XPath runtime context.
* @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.
*
* @throws javax.xml.transform.TransformerException
*/
public void error(XPathContext xctxt, String msg, Object[] args) throws javax.xml.transform.TransformerException {
java.lang.String fmsg = XSLMessages.createXPATHMessage(msg, args);
if (null != xctxt) {
ErrorListener eh = xctxt.getErrorListener();
TransformerException te = new TransformerException(fmsg, this);
eh.fatalError(te);
}
}
use of javax.xml.transform.ErrorListener in project j2objc by google.
the class XPath method bool.
/**
* Given an expression and a context, evaluate the XPath
* and return the result.
*
* @param xctxt The execution context.
* @param contextNode The node that "." expresses.
* @param namespaceContext The context in which namespaces in the
* XPath are supposed to be expanded.
*
* @throws TransformerException thrown if the active ProblemListener decides
* the error condition is severe enough to halt processing.
*
* @throws javax.xml.transform.TransformerException
* @xsl.usage experimental
*/
public boolean bool(XPathContext xctxt, int contextNode, PrefixResolver namespaceContext) throws javax.xml.transform.TransformerException {
xctxt.pushNamespaceContext(namespaceContext);
xctxt.pushCurrentNodeAndExpression(contextNode, contextNode);
try {
return m_mainExp.bool(xctxt);
} catch (TransformerException te) {
te.setLocator(this.getLocator());
ErrorListener el = xctxt.getErrorListener();
if (// defensive, should never happen.
null != el) {
el.error(te);
} else
throw te;
} catch (Exception e) {
while (e instanceof org.apache.xml.utils.WrappedRuntimeException) {
e = ((org.apache.xml.utils.WrappedRuntimeException) e).getException();
}
// e.printStackTrace();
String msg = e.getMessage();
if (msg == null || msg.length() == 0) {
msg = XSLMessages.createXPATHMessage(XPATHErrorResources.ER_XPATH_ERROR, null);
}
TransformerException te = new TransformerException(msg, getLocator(), e);
ErrorListener el = xctxt.getErrorListener();
// te.printStackTrace();
if (// defensive, should never happen.
null != el) {
el.fatalError(te);
} else
throw te;
} finally {
xctxt.popNamespaceContext();
xctxt.popCurrentNodeAndExpression();
}
return false;
}
use of javax.xml.transform.ErrorListener in project j2objc by google.
the class XPath method execute.
/**
* Given an expression and a context, evaluate the XPath
* and return the result.
*
* @param xctxt The execution context.
* @param contextNode The node that "." expresses.
* @param namespaceContext The context in which namespaces in the
* XPath are supposed to be expanded.
*
* @throws TransformerException thrown if the active ProblemListener decides
* the error condition is severe enough to halt processing.
*
* @throws javax.xml.transform.TransformerException
* @xsl.usage experimental
*/
public XObject execute(XPathContext xctxt, int contextNode, PrefixResolver namespaceContext) throws javax.xml.transform.TransformerException {
xctxt.pushNamespaceContext(namespaceContext);
xctxt.pushCurrentNodeAndExpression(contextNode, contextNode);
XObject xobj = null;
try {
xobj = m_mainExp.execute(xctxt);
} catch (TransformerException te) {
te.setLocator(this.getLocator());
ErrorListener el = xctxt.getErrorListener();
if (// defensive, should never happen.
null != el) {
el.error(te);
} else
throw te;
} catch (Exception e) {
while (e instanceof org.apache.xml.utils.WrappedRuntimeException) {
e = ((org.apache.xml.utils.WrappedRuntimeException) e).getException();
}
// e.printStackTrace();
String msg = e.getMessage();
if (msg == null || msg.length() == 0) {
msg = XSLMessages.createXPATHMessage(XPATHErrorResources.ER_XPATH_ERROR, null);
}
TransformerException te = new TransformerException(msg, getLocator(), e);
ErrorListener el = xctxt.getErrorListener();
// te.printStackTrace();
if (// defensive, should never happen.
null != el) {
el.fatalError(te);
} else
throw te;
} finally {
xctxt.popNamespaceContext();
xctxt.popCurrentNodeAndExpression();
}
return xobj;
}
Aggregations