hi all,

I am using SAXBeanWriter in a Cocoon Environment.
for this I had to patch the SAXBeanWriter to do the following:

I)

startElement( "", qname, qname , atts ) instead of
startElement( "", "", qname, atts ) 

-> the same for endElement

this behaviour is the "default", looked in examples and books for sax
nodes that have no namespace.
plus the SAXTransformer used in cocoon doesn't accept the original style
(simple didn't display it )

II)

optionalized the calls to startDocument( ) endDocument( ), which are
called in start(), end( ).

add a constructor element, the default behaviour is backward
compatiblity.

reason: frequently, in generators, you don't have control over the whole
document ( this violates xml ioc ;-) )

attached you find a patch against CVS 1.6 version.

thanks

-- Jakob
Index: SAXBeanWriter.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/io/SAXBeanWriter.java,v
retrieving revision 1.6
diff -r1.6 SAXBeanWriter.java
97c97,98
<     
---
>     /** should we generete start/endDocument events? */
> 	private boolean docEvents = true;
105a107,111
> 	public SAXBeanWriter(ContentHandler contentHandler, boolean docEvents ) {
> 		this( contentHandler );
> 		this.docEvents = docEvents;
> 			
> 	}
165c171
<         contentHandler.endElement("","",qualifiedName);
---
>         contentHandler.endElement("",qualifiedName,qualifiedName);
175c181
<         contentHandler.endElement("","",lastElement);
---
>         contentHandler.endElement("",lastElement,lastElement);
208c214
<         attributes.addAttribute("", "", qualifiedName, "CDATA", value);
---
>         attributes.addAttribute("", qualifiedName, qualifiedName, "CDATA", value);
221c227
<         contentHandler.startElement("","",lastElement,attributes);
---
>         contentHandler.startElement("",lastElement,lastElement,attributes);
230c236
<         contentHandler.startDocument();
---
>         if (docEvents ) contentHandler.startDocument();
240c246
<         contentHandler.endDocument();
---
>         if ( docEvents ) contentHandler.endDocument();

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to