Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 4706 invoked from network); 30 Apr 2004 00:44:04 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 30 Apr 2004 00:44:04 -0000 Received: (qmail 17496 invoked by uid 500); 30 Apr 2004 00:43:37 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 17465 invoked by uid 500); 30 Apr 2004 00:43:37 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: users@cocoon.apache.org Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 17403 invoked from network); 30 Apr 2004 00:43:36 -0000 Received: from unknown (HELO mail.gmx.net) (213.165.64.20) by daedalus.apache.org with SMTP; 30 Apr 2004 00:43:36 -0000 Received: (qmail 5828 invoked by uid 65534); 30 Apr 2004 00:43:43 -0000 Received: from a183069.studnetz.uni-leipzig.de (EHLO gmx.de) (139.18.183.69) by mail.gmx.net (mp006) with SMTP; 30 Apr 2004 02:43:43 +0200 X-Authenticated: #3483660 Message-ID: <4091A147.3040008@gmx.de> Date: Fri, 30 Apr 2004 02:43:51 +0200 From: Joerg Heinicke User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: de-de, de, en-us, en-gb, en MIME-Version: 1.0 To: users@cocoon.apache.org Subject: Re: Cocoon, XML:DB and custom generator problem References: <001101c42d39$b2fa2420$8500a8c0@pieper2> In-Reply-To: <001101c42d39$b2fa2420$8500a8c0@pieper2> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N On 28.04.2004 17:58, Christian Rosenberger wrote: > The result is in a XMLResource instance. > > Part of my custom generator code: > > this.contentHandler.startDocument(); > for (long i = 0; i < result.getSize(); i++) > { > resource = (XMLResource) > result.getResource(i); > resource.getContentAsSAX(this.contentHandler); > } > this.contentHandler.endDocument(); > > > 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 tags: Is only the XML declaration the problem or are there more, e.g. multiple root elements? > 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. You might need to put another ContentHandler into the pipe that just ignores startDocument() and endDocument(): 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 --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org