/** * Returns the specified exception as XML. * * <p>The XML for a {@link TransformerException} is: * <pre>{@code <exception class="[class]" type="[TransformerException|TransformerConfigException]"> * <message>[message]</message> * <stack-trace>[exception]</stack-trace> * <cause>[cause exception as XML (if any)]</cause> * <location line="[line]" column="[column]" public-id=[public-id]" system-id="[system-id]"/> * </exception> * }</pre> * * @param ex The exception to turn to XML. * @param xml The XML writer. * * @throws IOException Only if thrown by the XML writer. */ public static void toXML(TransformerException ex, XMLWriter xml) throws IOException { asTransformerExceptionXML(ex, xml, true); }
/** * Returns the specified exception as XML. * * @param ex The exception to turn to XML. * @param xml The XML writer. * @param wrap Whether to wrap the XML into an element. * * @throws IOException Only if thrown by the XML writer. */ public static void toXML(Throwable ex, XMLWriter xml, boolean wrap) throws IOException { if (ex instanceof SAXParseException) { asSAXParseExceptionXML((SAXParseException)ex, xml, wrap); } else if (ex instanceof TransformerException) { asTransformerExceptionXML((TransformerException)ex, xml, wrap); } else if (ex instanceof Exception) { asExceptionXML((Exception)ex, xml, wrap); } else if (ex instanceof Error) { asErrorXML((Error)ex, xml, wrap); } }