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
signature.asc
Description: This is a digitally signed message part
