I just tried a CodeGen with this under JiBX 1.2.2 ..

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
     xmlns:xsd="http://www.w3.org/2001/XMLSchema";
     xmlns="http://schema.somedomain.com";
     xmlns:r="http://schema.somedomain.com";
     targetNamespace="http://schema.somedomain.com";>
     elementFormDefault="qualified">

<xsd:simpleType name="ST_Id">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>

<xsd:attribute name="id" type="ST_Id" />

<xsd:complexType name="CT_Integer">
<xsd:attribute ref="r:id" use="optional" />
</xsd:complexType>

<xsd:element name="myInteger" type="CT_Integer" />
</xsd:schema>

With the use="optional" set in the above I get the attribute "Id" 
generated as an inner class reference:

public class CTInteger
{
     private Id id;
           o
           o
     public static class Id
     {
         private String id;

         /**
          * Get the 'id' attribute value.
          *
          * @return value
          */
         public String getId() {
             return id;
         }

         /**
          * Set the 'id' attribute value.
          *
          * @param id
          */
         public void setId(String id) {
             this.id = id;
         }
     }
}


However if I remove the use="optional" from the schema it generates no 
inner class for "Id" :
     public static class Id
     {
         private String id;

         /**
          * Get the 'id' attribute value.
          *
          * @return value
          */
         public String getId() {
             return id;
         }

         /**
          * Set the 'id' attribute value.
          *
          * @param id
          */
         public void setId(String id) {
             this.id = id;
         }
     }

I don't see the need for the inner class.  Is a way to prevent it from 
being generated?
I tried running CodeGen with "--prefer-inline=true" but that made no 
difference, but perhaps I'm reading that wrong?

TIA,

      - Bruce



------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to