I am using the Code Generator for the first time, to generate an XSD into Java classes.

I would like to not have all of the *Item classes. For example:

If my XML looks like:

<message>
   <responses>
      <alert>hello</alert>
   </responses>
</message>

I would like in Java to call


if (message.getResponses() != null){
Responses resp = message.getResponses(0); resp.getAlert(0); // ... and so on
}

instead of

if (message.getResponses() != null){
   for (int i =0; i < message.getResponses().getResponsesItemCount(); i++){
         ResponsesItem ri = message.getResponses().getResponseItem(i);
            // or you get the idea
   }
}


How can I acheive that? (Classes generated with all of the *Item classes)

Example XSD:

   <xsd:element name="message" >
       <xsd:complexType>
           <xsd:choice minOccurs="0" maxOccurs="unbounded">
               <!--responses-->
               <xsd:element name="responses">
                   <xsd:complexType>
                       <xsd:choice minOccurs="0" maxOccurs="unbounded">
                           <xsd:element ref="alert"/>

      ... And close all the elements....


Any hints or advice? I'm definately not an expert in XSD...


P.S> I've tried to search my brains out in this mailing group, but I can't find what I'm looking for.


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

   http://xircles.codehaus.org/manage_email

Reply via email to