You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Christian Rosenberger <Ch...@gmx.net> on 2004/05/01 00:30:31 UTC

RE: Cocoon, XML:DB and custom generator problem

Hello!

Joerg Heinicke wrote:

>> So I have two results in my ResourceSet. (one for each user). I am 
>> browsing these results and for each XMLResource in the ResourceSet I 
>> call the getContentAsSax method.
>> 
>> The result is a nonvalid XML document with two <?xml..> tags:

>Is only the XML declaration the problem or are there more, e.g. multiple 
>root elements

I get also different root elements, that means, that the complete documents
are delivered. But this could be handled with a new root element (e.g.
called "<xmldbresults>)


>> Any ideas what is going wrong in my Java code? Tried to call the 
>> startElement method after calling the startDocument, but have also no 
>> success with it!

>Don't understand the last sentence.

After the line "this.contentHandler.startDocument();" I insert a line with
"this.contentHandler.startElement(..);" with all required parameters. But I
had no success with this try.


>You might need to put another ContentHandler into the pipe that just 
>ignores startDocument() and endDocument():

Will try this!

>ContentHandler myContentHandler = new
MyContentHandler(this.contentHandler);
>this.contentHandler.startDocument();
>for (long i = 0; i < result.getSize(); i++)
>{
>     resource = (XMLResource)
>     result.getResource(i);
>     resource.getContentAsSAX(myContentHandler);
>}
>this.contentHandler.endDocument();

>private class MyContentHandler implements ContentHandler {

>     private ContentHandler ch;

>     MyContentHandler(ContentHandler ch) {
>         this.ch = ch;
>     }
>
>     startDocument() {
>         //ignore
>     }
>
>     endDocument() {
>         //ignore
>     }
>
>     allOtherMethodsFromContentHandler() {
>         this.ch.allOtherMethodsFromContentHandler();
>    }
>}
>
>Joerg

Thanks! Will give it a try!

Regards,
Christian

-- 
"Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen!
Jetzt aktivieren unter http://www.gmx.net/info


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org