tags:

views:

421

answers:

1

I am rendering a command class as XML via

render foo as XML

where foo is an instance of the command class.

This successfully returns an XML for the objects value. However, the generated XML also contains a class element, e.g., my.package.ClassNameOfCommandObject

This also happens when I do the same for a standard domain class, as well as when I use the encodeAsXML() method of the command object.

How can eliminate the element from the generated XML?

+1  A: 

I took a look through the XML converter docs, they don't seem to have the option you need. The simplest way (though a hack) is to simply generate the XML, and do string substitution in the resulting string.

This thread may be of use - it goes a bit into internals of the process and where you could overwrite things.

Of course, you can always just use markupbuilder if you need something very custom. This post has an example.

Jean Barmash