The DISABLE_ESCAPING property on the characters() method (and indeed the whole Receiver interface) is designed primarily for internal use within Saxon rather than as a public API. Generally that means that you may need to study the code in order to understand exactly what it does.

Like disable-output-escaping in the XSLT language, this property has no effect unless the events are being directed to a serializer. In your case, I think the events are directed to a tree builder, which will ignore this property.

Saxon isn't going to parse your XML fragment when building a tree; you will have to do this yourself.

Michael Kay

On 11/07/2012 09:22, Lucas Soltic wrote:

I'm currently working on a Java project that uses the Saxon Java API where a wrapper (source code here) around Receiver has been developed and I want to output some raw data to an XML output. For example, let's say I have computed the string "<p>test data</p>", I would like to be able to insert this roughly into the XML output. But the computed string could also be "foo{<p>test data</p>}bar" so I can't just parse my computed string as if it was a valid full XML tree and insert it as a node.

For now, if I use (through the wrapper) Receiver.characters(...) it will output "&lt;p&gt;test data&lt;/p&gt;".
However, the documentation of Receiver.characters() says that giving DISABLE_ESCAPING as third parameter will "Disable escaping for this text node". But, even if I use Receiver.characters(... , ReceiverOptions.DISABLE_ESCAPING), the XML output still contains "&lt;p&gt;test data&lt;/p&gt;".

Thus I am wondering : is DISABLE_ESCAPING really supposed to do what I think it should ? ie. let me output "<p>test data</p>".


Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 

saxon-help mailing list archived at