Hi everyone,
I am trying to have several XML elements with different attributes under the
same class. Here's an example
Java class:
public class Thing
{
private String elem;
private String attrib;
private String elem2,
private String attrib2;
// getters and setters
}
Castor mapping:
<class name="Thing">
<map-to xml="root"/>
<field name="elem" type="java.lang.String">
<bind-xml name="element1" node="element" />
</field>
<field name="attrib" type="java.lang.String">
<bind-xml name="attribute" location="element1" node="attribute" />
</field>
<field name="elem2" type="java.lang.String">
<bind-xml name="element2" node="element" />
</field>
<field name="attrib2" type="java.lang.String">
<bind-xml name="attribute2" location="element2" node="attribute" />
</field>
</class>
Output:
<Thing>
<element1 attribute="Attribute text">element one text</element1>
<element2>element 2 text</element2>
</Thing>
The attribute two does not show up, no matter what I do. If I remove the
mapping for element 1, then element 2 shows up. It seems that I can only
have one generated attribute per class. I have noticed this behaviour with
version 1.1.1 and 1.0.5. Is there any way around this other than creating
my own sub classes for each element that requires an attribute?
Thanks!
--
View this message in context:
http://www.nabble.com/Multiple-attributes-under-the-same-class-tf3834374.html#a10855477
Sent from the Castor - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email