xml-xalan-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Crook, Charles" <Cro...@tvratings.com>
Subject RE: DOM to StreamSource
Date Thu, 10 Oct 2002 18:36:30 GMT
I think you can use a String -> StringReader -> StreamSource

public void transform( String  xmlString, StringWriter outWriter,
	String xslStylesheet,
	String parmNames[],
	String parmValues[]  ){
try{	
	StringReader xmlReader = new StringReader( xmlString );
	StreamSource streamSource = new StreamSource( xmlReader ) ;
	...

So if you turn your Document into a String of its content, you can skip the
file creation.

-----Original Message-----

From: mkwan@ca.ibm.com [mailto:mkwan@ca.ibm.com]
Sent: Thursday, October 10, 2002 2:06 PM
To: Pae Choi
Cc: xalan-dev@xml.apache.org; xalan-j-users@xml.apache.org
Subject: Re: DOM to StreamSource


The solution I know of is to use the Xerces serializer
(org.apache.xml.serialize.*) to serialize a w3c Document to a file, and
then create a StreamSource from that file. StreamSource can only be created
from a file or an input stream.

Morris Kwan
XSLT Development
IBM Toronto Lab
Tel: (905)413-3729
Email: mkwan@ca.ibm.com



 

                      "Pae Choi"

                      <paechoi@earthlin        To:
<xalan-j-users@xml.apache.org>, <xalan-dev@xml.apache.org>                 
                      k.net>                   cc:

                                               Subject:  DOM to StreamSource

                      10/10/2002 06:34

                      AM

 

 




Hello,

First of all, my applogies if this has been asked and answered.

Say we have a DOM or DOMSource, i.e., an instance of org.w3c.dom.Document
or
javax.xml.transform.dom.DOMSource.

What would be a simple way to convert a DOM or DOMSource to StreamSource,
i.e., javax.xml.transform.stream.StreamSource?

Any suggenstions and/or URLs are welcome and will be appreciated.

Reagrds,


Pae





Mime
View raw message