Hi Castor community,

 I am facing some strange behavior during mapping, I am using castor-1.2.

 Here is the java objects :
public class Request
  private String id;
  private String requestState;
  private Certificate producedCertificate

public class Certificate
  private String id;
  private String cn;
  private String email;

and the mapping files are :
  <class name="Request" auto-complete="false" verify-constructable="false">
    <map-to xml="request"/>
    <field name="id" type="java.lang.Long">
      <bind-xml name="id" node="attribute"/>
    </field>
    <field name="requestState" type="java.lang.String">
      <bind-xml name="state" node="attribute"/>
    </field>
    <field name="producedCertificate" type="Certificate" container="true">
      <bind-xml name="certificate" node="element"/>
    </field>
  </class>


  <class name="Certificate" auto-complete="false"
verify-constructable="false">
    <map-to xml="certificate"/>
    <field name="id" type="java.lang.Long">
      <bind-xml name="id" node="attribute" location="certificate"/>
    </field>
    <field name="cn" type="java.lang.String">
      <bind-xml name="CN" node="element" location="certificate"/>
    </field>
    <field name="email" type="java.lang.String">
      <bind-xml name="email" node="element"/>
    </field>
  </class>

  The result is not what I expected :
        <request id="101227" state="PROCESSED" id="101234">
            <certificate id="101227">
                <CN>Tests_1200913848481</CN>
            </certificate>
            <email>[EMAIL PROTECTED]</email>
        </request>

instead of
        <request state="PROCESSED" id="101234">
            <certificate id="101227">
                <CN>Tests_1200913848481</CN>
            </certificate>
            <email>[EMAIL PROTECTED]</email>
        </request>

  There are two "id" attributes in the <request> tag, one from the Request
the other from the Certificate, this xml document is not valid !
  Could someone help me to resolve this problem? Could you tell me if this
is a bug or if I'm doing something wrong ?

Thanks in advance

Eric TOURNIER

Reply via email to