Project

Profile

Help

#Document

Added by Anonymous almost 19 years ago

Legacy ID: #3204702 Legacy Poster: alylad (alylad)

Hi, I am using Saxon with the Xerces parser. When I use the TransformerFactory.getTransformer() to get a copy of the source to the results, my output is wrapped in a #Document element? My output is well formed before I try to transform it. <#Document> <myoutput/> </#Document> Does anyone know why it might be doing this? Cheers


Replies (3)

Please register to reply

RE: #Document - Added by Anonymous almost 19 years ago

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

This is very peculiar. I need to see more details of what you are doing. Are you 100% sure that the TransformerFactory you are getting back is Saxon? What Saxon release are you using? The getNodeName() method on a Document node returns the value "#document" (not "#Document"),. This suggests to me that you could have hit the same problem as https://sourceforge.net/mailarchive/message.php?msg_id=11522574 (which I don't think I recorded in the bugs list because I wasn't sure what the consequences were). I thought, however, that this problem was specific to the Oracle DOM. Michael Kay

RE: #Document - Added by Anonymous almost 19 years ago

Legacy ID: #3206499 Legacy Poster: alylad (alylad)

Hi, thanks for the quick response. I thought I was using the Saxon transformer (Saxon8 jar). Strange you should mention Oracle because it just so happens that I am using Oracle sqlx! And I am not sure what it resets under the covers. If I use the Oracle XMLType's getString() method, it serializes the output correctly. If I attempt to serialise it myself, I get problems. First I called the XMLType's getDOM() method to get a DOM. I then wrap this in a DOM Source and do this: TransformerFactory tf = TransformerFactory.newInstance(); // get a transformer Transformer t = tf.newTransformer(); // set the output properties t.setOutputProperties(outputProperties); // transform to a stream // get a transformer factory t.transform(domSource, streamResult); I assumed that this would still pick up Saxon, as this was what I originally set. Perhaps Oracle is resetting the TransformerFactory? Typical Oracle playing with it's env. Any light you can shine on this would be great. I apologise if this is a non-Saxon issue. Cheers Alex

RE: #Document - Added by Anonymous almost 19 years ago

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

I think you are probably picking up the Oracle DOM and the Saxon XSLT transformer, which was the combination cited in the original bug report. If you are able to patch the Saxon source, the fix is to change the places in DOMSender.java where Saxon tests "if (node instanceof Element)" and change them to "if (node.getNodeType() == Node.ELEMENT_NODE)". I think there are a couple of occurrences around lines 88 and 111. Michael Kay

    (1-3/3)

    Please register to reply