Project

Profile

Help

Weird problem with d-o-e in custom Instructio

Added by Anonymous over 18 years ago

Legacy ID: #3408869 Legacy Poster: Matthew Moore (m4ttm00re)

I have created a custom intstruction using the SQLQuery instruction as an example. I am sending an XML document to the receiver that is to be written without output escaping as a String. I get two different results when running from within Eclipse and Tomcat 5.5.9 (The classpath of the run configuration is the same as the web application) I am using Saxon-B 8.5.1 (and Jaxen 1.1beta7, if that matters) JDK 1.5.0_04-b05 Ex: String myString = "<TestDocument><TestNode/></TestDocument>"; SequenceReceiver out = context.getReceiver(); out.characters(myString, locationId, ReceiverOptions.DISABLE_ESCAPING); Eclipse Result: <script> var xmlString = '<?xml version="1.0" encoding="UTF-8"?>' + '<TestDocument>' + ' <TestNode/>' + '</TestDocument>'; </script> Tomcat Result: <script> var xmlString = <?javax.xml.transform.disable-output-escaping ?> '&lt;?xml version="1.0" encoding="UTF-8"?&gt;' + '&lt;TestDocument&gt;' + ' &lt;TestNode/&gt;' + '&lt;/TestDocument&gt;'<?javax.xml.transform.enable-output-escaping ?>; </script> Any help would be appreciated. Thanks, Matt Moore


Replies (2)

RE: Weird problem with d-o-e in custom Instru - Added by Anonymous over 18 years ago

Legacy ID: #3408907 Legacy Poster: Michael Kay (mhkay)

There's clearly some configuration issue here that you need to pin down: it's not possible to tell from the information given what the difference between the two environments is. As required by the JAXP spec, Saxon when outputting to a SAXResult sends a processing instruction named javax.xml.transform.disable-output-escaping to the ContentHandler to indicate that output-escaping is being disabled, and a PI named javax.xml.transform.enable-output-escaping to re-enable it. (See the Javadoc for javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING) In one of your two runs this PI is being recognized and acted upon by the ContentHandler, in the other it is being ignored and serialized as an ordinary processing instruction. Michael Kay

RE: Weird problem with d-o-e in custom Instru - Added by Anonymous over 18 years ago

Legacy ID: #3412279 Legacy Poster: Matthew Moore (m4ttm00re)

I found the issue, when my xslt was being transformed on the server it used a DOMSource and the XMLWriter used to serialize it had escapeText set to true. Thank your for your help. Matt Moore

    (1-2/2)

    Please register to reply