xalan-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Wolf (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (XALANJ-361) Transformation of DOMSource not working.
Date Fri, 02 Nov 2012 16:41:12 GMT

    [ https://issues.apache.org/jira/browse/XALANJ-361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13489527#comment-13489527
] 

Chris Wolf commented on XALANJ-361:
-----------------------------------

I would say this is a bug because when javax.xml.tranform.Transformer.transform is called
with javax.xml.transform.stream.StreamSource, then namespace aware is set true, but if it's
called with javax.xml.transform.dom.DOMSource, then namespace aware is not set true.  I would
advise changing com.sun.org.apache.xalan.internal.xsltc.compiler.Parser.parse(XMLReader reader,
InputSource input) to call
XMLReader.seFeature("http://xml.org/sax/features/namespace", true) such that it is consistent
with  com.sun.org.apache.xalan.internal.xsltc.compiler.Parser.parse(InputSource) which already
sets namespace awareness to true.  I also filed a bug with Oracle/Sun for this issue.
                
> Transformation of DOMSource not working.
> ----------------------------------------
>
>                 Key: XALANJ-361
>                 URL: https://issues.apache.org/jira/browse/XALANJ-361
>             Project: XalanJ2
>          Issue Type: Bug
>      Security Level: No security risk; visible to anyone(Ordinary problems in Xalan projects.
 Anybody can view the issue.) 
>          Components: transformation, Xalan-interpretive
>    Affects Versions: 2.2.x
>         Environment: Operating System: Windows NT/2K
> Platform: PC
>            Reporter: Shourya Shukla
>         Attachments: ASF.LICENSE.NOT.GRANTED--TestServlet.java, ASF.LICENSE.NOT.GRANTED--wizard3.xsl
>
>
> Hi,
> I have encountered a problem with Xalan. (2.2D6, 2.2D7, and also 2.1.0) .I am 
> constructing a DOM document in my code and passing it to the transformer as a 
> DOMSource object. However, I get a blank output. When I serialize the Document 
> and read it back in as a StreamSource it works fine. 
> Here is the code
> //Does not work 
> Writer outputWriter = resp.getWriter(); //resp is an HttpServletResponse object
> Document xmlRes = (Document) getXMLNode(); //gets a org.w3c.dom.Document object
> xmlTransformer.transform( new DOMSource(xmlRes.getDocumentElement()), 
> 	new javax.xml.transform.stream.StreamResult
>                  	(outputWriter));
> //However, this works fine
> org.apache.xml.serialize.XMLSerializer outXml = new 
> org.apache.xml.serialize.XMLSerializer(new java.io.FileOutputStream
> ("test.xml"), null);
> outXml.serialize(xmlRes.getDocumentElement());
> xmlTransformer.transform( new javax.xml.transform.stream.StreamSource(new 
> java.io.File("test.xml")), 
> 			new javax.xml.transform.stream.StreamResult
>                         	(outputWriter) );
> I have not found anything in the docs to cause this behaviour,
> Thanks,
> Shourya

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xalan.apache.org
For additional commands, e-mail: dev-help@xalan.apache.org


Mime
View raw message