cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <...@apache.org>
Subject Re: parsing xml in flowscript.
Date Sun, 01 May 2005 21:42:49 GMT
Il giorno 01/mag/05, alle 23:06, Aurélien DEHAY ha scritto:

> I'm trying to parse an xml stream from a pipeline result in flowscript.
> I've got the following code:
>
> var stream = new java.io.ByteArrayOutputStream;
> cocoon.processPipelineTo("etape2", {"url": url}, stream );
> var document =  
> DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(stream) 
> ;
>

> 2 questions then:
>       * Why parse(String uri) is taken rather than parse(InputStream
>         is)?

Because a ByteArrayOutputStream is not an InputStream. Try;

var is = new ByteArrayInputStream(stream.toByteArray());
....parse(is);

HTH,

	Ugo

-- 
Ugo Cei
Tech Blog: http://agylen.com/
Source.zone: http://sourcezone.info/
Wine & Food Blog: http://www.divinocibo.it/

Mime
View raw message