cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aurélien DEHAY ...@zorel.org>
Subject parsing xml in flowscript.
Date Sun, 01 May 2005 21:06:08 GMT
Hi list.

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);

The "etape2" result is something like this:

<?xml version="1.0" encoding="utf-8"?><infos>
    <type>RSS 2.0</type>
</infos>

Cocoon raise an error:

java.net.MalformedURLException: no protocol: <?xml version="1.0" encoding="utf-8"?><infos>

    <type>RSS 2.0</type>
    
</infos>

I can see the following stack trace in Cocoon error.log:

Caused by: java.net.MalformedURLException: no protocol: <?xml version="1.0" encoding="utf-8"?><infos>
    <type>RSS 2.0</type>

</infos>
        at java.net.URL.<init>(URL.java:567)
        at java.net.URL.<init>(URL.java:464)
        at java.net.URL.<init>(URL.java:413)
        at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
        at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)



2 questions then:
      * Why parse(String uri) is taken rather than parse(InputStream
        is)?
      * Is there a better way to set infos in pipeline and retrieve them
        in flow script (the idea is to get a external stream with
        cincluden transform it with xsl and retrieve, for example, the
        type of a syndiction (rss/atom/etc.).

Regards.

-- 
Aurélien DEHAY   http://zorel.org
      http://logicielslibres.info

Mime
View raw message