xsl-list
[Top] [All Lists]

RE: [xsl] Identify transform with disabled output escaping

2006-11-15 12:57:41

I have an org.w3c.dom.Node, and I would like to serialize it 
to a String. To achieve this, I have been using this code:

void writeDOMToSourceNode(Node n, StreamResult sr) {
    TransformerFactory trf = TransformerFactory.newInstance();
    Transformer tr = trf.newTransformer();
    tr.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
    tr.transform(new DOMSource(n), sr);
    //exception handling and turning the sr into a String omitted }

i.e. transform the Node with an empty stylesheet. Now this 
code gives me the strange stuff with all the >s et al.

So the next question has to be, what's in the DOM? From the evidence of the
serialized output, it's some text nodes with lots of angle brackets in the
text.

Have you tried using the DOM's serialization methods (toXML() or whatever)
directly?

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--