cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lionel Crine <cr...@4dconcept.fr>
Subject Question about parser.
Date Fri, 07 May 2004 13:48:54 GMT
Hi again,

I have some trouble in my pipeline and don't really what's going on.

In a transformer (SAX), i get DOM from an XML base and then I parse it in 
the endElement method.


I tried two ways :

1/
DOMStreamer s = new DOMStreamer(this.contentHandler, this.lexicalHandler);
s.stream(DOMResult);

2/
String strResult = XMLUtils.serializeNode(DOMResult, 
UtilsFunction.getInstance().setProperties(true)); --> UtilsFunction 
redefine the property object.

InputSource inputSource = new InputSource(new 
ByteArrayInputStream(strResult.getBytes(UtilsParam.getInstance().UTF8)));
SAXParser parser = (SAXParser) this.manager.lookup(SAXParser.ROLE);
parser.parse(inputSource, new IncludeXMLConsumer(super.xmlConsumer));


1/ With the first method --> When I tried to put an "xslt" transformer 
after this one, I get an error :

Original Exception: java.lang.RuntimeException: java.lang.RuntimeException
         at 
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3364)
         at 
org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(TransformerHandlerImpl.java:427)
         at 
org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:91)
         at 
org.apache.cocoon.transformation.TraxTransformer.endDocument(TraxTransformer.java:583)


2/ With the second method --> All is Fine.

What's the difference between this two methods ?


PS : The second method is really not clean because it converts the DOM as 
String and get it as Bytes (it will tend to encoding errors even if I know 
what i am doing).



Thanks in advance.
Lionel







Lionel CRINE
Ingénieur Systèmes documentaires
Société : 4DConcept
22 rue Etienne de Jouy 78353 JOUY EN JOSAS
Tel : 01.34.58.70.70 Fax : 01.39.58.70.70


Mime
View raw message