Disable output escaping when using javax.xml.transformer and StreamResult
843834Jan 22 2003 — edited Mar 13 2003I'm using the following snippet to ouput a DOM Document, which contains some text elements, which in turn contain some anchor tags (<a>), to svg.
My problem is that it always escapes the brackets (so the output contains the amplt; instead of the <,etc).
I can see that there is a field named PI_DISABLE_OUTPUT_ESCAPING in the Result class (its defined as final), but can't figure out how to implement it!
This is my snippet:
TransformerFactory trans = TransformerFactory.newInstance();
Transformer transformer = trans.newTransformer();
transformer.setOutputProperty("method", "xml");
transformer.setOutputProperty("indent", "yes");
transformer.setOutputProperty("omit-xml-declaration", "no");
transformer.transform(new DOMSource(myDoc), new StreamResult(writer));
I've tried referencing the xmlns:xls namespace and setting the disable-output-escaping="yes" attribute in my text node, as well as trying every sequence of escape characters I can think of to try to get it to output a simple < within a text tag. - al to no avail.
I can't imagine that there's not a simple solution to this quandry, and I'm chasing my tail here - any help would be greatly appreciated.