use of javax.xml.transform.ErrorListener in project j2objc by google.
the class StylesheetHandler method pushSpaceHandling.
/**
* Push boolean value on to the spacePreserve stack depending on the value
* of xml:space=default/preserve.
*
* @param attrs list of attributes that were passed to startElement.
*/
void pushSpaceHandling(Attributes attrs) throws org.xml.sax.SAXParseException {
String value = attrs.getValue("xml:space");
if (null == value) {
m_spacePreserveStack.push(m_spacePreserveStack.peekOrFalse());
} else if (value.equals("preserve")) {
m_spacePreserveStack.push(true);
} else if (value.equals("default")) {
m_spacePreserveStack.push(false);
} else {
SAXSourceLocator locator = getLocator();
ErrorListener handler = m_stylesheetProcessor.getErrorListener();
try {
//"Illegal value for xml:space", locator));
handler.error(new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_ILLEGAL_XMLSPACE_VALUE, null), locator));
} catch (TransformerException te) {
throw new org.xml.sax.SAXParseException(te.getMessage(), locator, te);
}
m_spacePreserveStack.push(m_spacePreserveStack.peek());
}
}
use of javax.xml.transform.ErrorListener in project j2objc by google.
the class StylesheetHandler method warn.
/**
* Warn the user of an problem.
*
* @param msg An key into the {@link org.apache.xalan.res.XSLTErrorResources}
* table, that is one of the WG_ prefixed definitions.
* @param args An array of arguments for the given warning.
*
* @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.
* @xsl.usage internal
*/
public void warn(String msg, Object[] args) throws org.xml.sax.SAXException {
String formattedMsg = XSLMessages.createWarning(msg, args);
SAXSourceLocator locator = getLocator();
ErrorListener handler = m_stylesheetProcessor.getErrorListener();
try {
if (null != handler)
handler.warning(new TransformerException(formattedMsg, locator));
} catch (TransformerException te) {
throw new org.xml.sax.SAXException(te);
}
}
use of javax.xml.transform.ErrorListener in project j2objc by google.
the class StylesheetHandler method error.
/**
* Receive notification of a recoverable 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#error}
* method chooses to flag this condition as an error.
*/
public void error(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException {
String formattedMsg = e.getMessage();
SAXSourceLocator locator = getLocator();
ErrorListener handler = m_stylesheetProcessor.getErrorListener();
try {
handler.error(new TransformerException(formattedMsg, locator));
} catch (TransformerException te) {
throw new org.xml.sax.SAXException(te);
}
}
use of javax.xml.transform.ErrorListener in project j2objc by google.
the class XPath method error.
/**
* Tell the user of an error, and probably throw an
* exception.
*
* @param xctxt The XPath runtime context.
* @param sourceNode Not used.
* @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.
*/
public void error(XPathContext xctxt, int sourceNode, String msg, Object[] args) throws javax.xml.transform.TransformerException {
String fmsg = XSLMessages.createXPATHMessage(msg, args);
ErrorListener ehandler = xctxt.getErrorListener();
if (null != ehandler) {
ehandler.fatalError(new TransformerException(fmsg, (SAXSourceLocator) xctxt.getSAXLocator()));
} else {
SourceLocator slocator = xctxt.getSAXLocator();
System.out.println(fmsg + "; file " + slocator.getSystemId() + "; line " + slocator.getLineNumber() + "; column " + slocator.getColumnNumber());
}
}
use of javax.xml.transform.ErrorListener in project j2objc by google.
the class XPath method warn.
/**
* Warn the user of an problem.
*
* @param xctxt The XPath runtime context.
* @param sourceNode Not used.
* @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.
*/
public void warn(XPathContext xctxt, int sourceNode, String msg, Object[] args) throws javax.xml.transform.TransformerException {
String fmsg = XSLMessages.createXPATHWarning(msg, args);
ErrorListener ehandler = xctxt.getErrorListener();
if (null != ehandler) {
// TO DO: Need to get stylesheet Locator from here.
ehandler.warning(new TransformerException(fmsg, (SAXSourceLocator) xctxt.getSAXLocator()));
}
}
Aggregations