Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Disable output escaping when using javax.xml.transformer and StreamResult

843834Jan 22 2003 — edited Mar 13 2003
I'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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 10 2003
Added on Jan 22 2003
4 comments
1,427 views