Hi,

can you please create a new issue at

http://jira.codehaus.org/browse/CASTOR

and attach all relevant feles, e.g. a JUnit test case, mapping file,
domain class(es), .... If you followed the guidelines available at

http://www.castor.org/how-to-submit-an-xml-bug.html

that would ease our life and thus reduce turn-around time.

Thanks in advance
Werner

herman404 wrote:
> 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!


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to