Re: Question about parser.
You are right, It's a user question. Won't make the mistake. Anyway here is the answer : I stream my dom in an SAX endElement method So I had two startDocument. So, to make it work, You should DOM the DOMResult.getDocumentElement(); Lionel At 13:38 08/05/2004 +0200, you wrote: On Fri, 2004-05-07 at 15:48, Lionel Crine wrote: > 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 ? The serialization in between. The problem is either that the DOM-tree is invalid or a bug in the DOMStreamer. The first option is more likely. To find out what could be wrong, insert a LogTransformer in the pipeline and examine its output. If you can't find anything wrong in it, let us have a look at it. PS: we've got a user mailing list for this sort of questions. -- Bruno Dumon http://outerthought.org/ Outerthought - Open Source, Java & XML Competence Support Center [EMAIL PROTECTED] [EMAIL PROTECTED] 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
Re: Question about parser.
On Fri, 2004-05-07 at 15:48, Lionel Crine wrote: > 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 ? The serialization in between. The problem is either that the DOM-tree is invalid or a bug in the DOMStreamer. The first option is more likely. To find out what could be wrong, insert a LogTransformer in the pipeline and examine its output. If you can't find anything wrong in it, let us have a look at it. PS: we've got a user mailing list for this sort of questions. -- Bruno Dumon http://outerthought.org/ Outerthought - Open Source, Java & XML Competence Support Center [EMAIL PROTECTED] [EMAIL PROTECTED]
Question about parser.
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