Hunsberger, Peter <[EMAIL PROTECTED]> screwed up and wrote:

> 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 ???

Well, the code might work, but it's not consistent with my comment about
checking for startDocument....  The code's probably the way to go?

Reply via email to