jastrachan | 15 Apr 11:33 2004
Picon

Re: SaxBuilder writes empty element and attribute names

This is probably a namespace issue - i.e. we're probably outputting the 
local names and the Cocoon is expecting the QNames (fully qualified 
names)?

Could enabling / disabling namespace support in the SAX tool help?

One option might be to provide a default namespace prefix & URI for a 
SAX builder to use.

On 15 Apr 2004, at 09:54, Bertrand Delacretaz wrote:
> Hello,
>
> I'm trying to use GroovyMarkup in Cocoon using a SaxBuilder, but 
> element and attribute names come out empty.
>
> I'm executing the Groovy code from BSF, using the existing BSF block 
> in Cocoon (just changed it to make the ContentHandler of the Cocoon 
> pipeline available to scripts).
>
> Note that I'm new to Groovy, I've only played with a few examples yet.
>
> The output looks like
> < ="folks">< ="123">< ="groovy"/></></>
>
> Document structure is correct, but element and attributes names are 
> missing, and only the first attribute is written out.
>
> Here's my code:
>
>   import groovy.xml.SAXBuilder
>
>   contentHandler = bsf.lookupBean("contentHandler")
>   xml = new SAXBuilder(contentHandler)
>
>   // seems like I have to call start/endDocument myself here
>   contentHandler.startDocument()
>
>   // generate XML
>   xml.people(kind:'folks', groovy:true) {
>     person(x:123,  name:'James', cheese:'edam') {
>       project(name:'groovy')
>     }
>   }
>
>   contentHandler.endDocument()
>
>
> I did check that the ContentHandler is correct, if I call 
> startElement/endElement on it I'm able to create a well-formed 
> document.
>
> Am I overlooking something evident?
> If not, I'll look in more detail at the interaction between my Groovy 
> code and the ContentHandler.
>
> Thanks for any help!
> --
>   Bertrand Delacretaz
>   independent consultant, Lausanne, Switzerland
>   http://www.codeconsult.ch
>
> _______________________________________________
> groovy-user mailing list
> groovy-user@...
> http://lists.codehaus.org/mailman/listinfo/groovy-user
>
>

James
-------
http://radio.weblogs.com/0112098/

Gmane