I found out the receiver chain contains a TreeReceiver so I guess you're right. I didn't especially want to use methods designed for internal use, but Receiver is one of the classes used by the SaxonBuilder. And the SaxonBuilder seems to be the way to go in the project I'm working on. That's why I wanted to understand the behavior of DISABLE_ESCAPING.
As for parsing the XML fragment, although I understand it could be a solution, if it's possible to use ready-to-use solutions, it'd be better.
Thanks for your help
Le 11 juil. 2012 à 10:57, Michael Kay a écrit :
>
> 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
> Saxonica
>
> On 11/07/2012 09:22, Lucas Soltic wrote:
>> Hello,
>>
>> 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 "<p>test data</p>".
>> 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 "<p>test data</p>".
>>
>> Thus I am wondering : is DISABLE_ESCAPING really supposed to do what I think it should ? ie. let me output "<p>test data</p>".
>>
>> Regards,
>> Lucas SOLTIC
>>
>>
>> ------------------------------------------------------------------------------
>> 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
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>
>>
>> _______________________________________________
>> saxon-help mailing list archived at http://saxon.markmail.org/
>> saxon-help@...
>> https://lists.sourceforge.net/lists/listinfo/saxon-help
>
>
> ------------------------------------------------------------------------------
> 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
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> saxon-help@...
> https://lists.sourceforge.net/lists/listinfo/saxon-help
|