Hello, I don't think there is a way to add a constant attribute but I am fairly new myself.
You could try to use XSLT to transform the generated XML and add the attribute by yourself. I would be very interested in the XSLT code that could produce the changes you are trying to accomplish. So please let me know you are going to tackle this problem. Cheers, Philipp On Thu, Jun 17, 2010 at 2:01 AM, toramanan <[email protected]> wrote: > > Hi, > > I am bit new castor and need some help in generating an xml in the below > format from a java object. > > <?xml version="1.0" encoding="UTF-8"?> > <PARENT_REQUEST> > <NODE1>NODE1_DATA</NODE1> > <NODE2>NODE2_DATA</NODE2> > <INNER_NODE ATTRIB="ADATA"> > <INNER_NODE_1 ATTRIB="ADATA">A</INNER_NODE_1> > <INNER_NODE_2 ATTRIB="ADATA">B</INNER_NODE_2> > <INNER_NODE_3 ATTRIB="ADATA">C</INNER_NODE_3> > <INNER_NODE_4 ATTRIB="ADATA">D</INNER_NODE_4> > <INNER_NODE_5 ATTRIB="ADATA">E</INNER_NODE_5> > <INNER_NODE_6 ATTRIB="ADATA"/> > <INNER_NODE_7 ATTRIB="ADATA">F</INNER_NODE_7> > <INNER_NODE_8 ATTRIB="ADATA">G</INNER_NODE_8> > </INNER_NODE> > </PARENT_REQUEST> > > The issue here is "ATTRIB=ADATA" is constant attribute that need to be > applied to all the INNER_NODE and its child nodes. I don't want to write > separate class for each INNER_NODE_1 to n to achieve this output. Is there a > way to add the attribute ATTRIB=ADATA as a constant during runtime > (marshalling) for the elements in the INNER_NODE ? > > > -- > View this message in context: > http://old.nabble.com/Help-in-Castor-Marshalling-tp28909074p28909074.html > Sent from the Castor - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

