Return-Path: Delivered-To: apmail-xml-cocoon-dev-archive@xml.apache.org Received: (qmail 49216 invoked by uid 500); 4 Apr 2003 23:17:44 -0000 Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-dev@xml.apache.org Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 49202 invoked from network); 4 Apr 2003 23:17:43 -0000 Received: from gate2.stjude.org (192.55.208.12) by daedalus.apache.org with SMTP; 4 Apr 2003 23:17:43 -0000 Received: by gate2.stjude.org; (8.9.3/1.3/10May95) id RAA1176235; Fri, 4 Apr 2003 17:17:50 -0600 (CST) Received: from somewhere by smtpxd Message-ID: <601F6322AD71D5118D6C0003472515290660D1DC@sjmemexc1.stjude.org> From: "Hunsberger, Peter" To: "'cocoon-dev@xml.apache.org'" Subject: RE: Text serializer broken in 2.0.4 ? Date: Fri, 4 Apr 2003 17:17:39 -0600 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Vadim Gritsenko wrote: >> > >> The work around seems to be to wrap the text with pseudo XML eg: > >> > >> > >> Generated text > >> > > > > > > That is a common requirement for XML parsers. > > > >> > >> But I believe this shouldn't be necessary? Strangely enough when I > >> do this, > >> the "hack" elements are not output and everything works > fine. Anyone > >> have > >> any ideas where the problem might lie? > > > > Related: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10242 > Hmm, I didn't find that when searching the archives; could have save me half a day (sigh).... I sort have to agree, there needs to be some debug level indication of this. Thinking out loud here: couldn't TextSerializer check if startDocument has been called before the first instance of character and if not call startDocument? This would make things both backward compatible with people who are currently wrapping the text with XML and work as expected for those of us porting text production into Cocoon for the first time. private hasWrapperElement = false; public void characters(char c[], int start, int len) throws SAXException { if (!hasWrapperElement) { // Maybe log something here? startElement( "hack",... ); } super.characters(...); if (!hasWrapperElement) { endElement( "hack",... ); hasWrapperElement = true; } } public void startElement(String eltUri, String eltLocalName, String eltQName, Attributes attrs) throws SAXException { hasWrapperElement = true; super.startElement(...); } Yuck, but ???