cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hunsberger, Peter" <Peter.Hunsber...@stjude.org>
Subject RE: Text serializer broken in 2.0.4 ?
Date Fri, 04 Apr 2003 23:20:25 GMT
Hunsberger, Peter <Peter.Hunsberger@stjude.org> 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?

Mime
View raw message