Hi Keith,

I've begun looking at these issues, and would appreciate your guidance.

In summary: I think there are two issues with MappingTool:
 1. namespaces are not handled correctly
 2. choice elements are not handled correctly

In both cases, I am beginning to suspect that the issue is actually with the
generation of *Descriptor.java code.

Handling the choice element appears to be the simplest.  The output from
MappingTool has cst:required="true" for all child elements, yet this won't
work without modification since only one of the children should be present.
Code in DescriptorSourceFactory.createDescriptor() generates this call based
on the FieldInfo.getRequired(), which in turn is set in
SourceFactory.processContentModel().  This latter method has code to clear
the field required flag where minOccurs="0", so I'm thinking of adding code
there to also cover the "parent is a choice element" condition.


Secondly, while it would be possible to generate namespace prefixes in
MappingTool for classes that have a namespace but no prefix, it strikes me
that the issue is really that the *Descriptor.java classes do not carry the
namespace prefix, although there is provision for them to do so.  From the
examples, a valid class element valid in a mapping looks something like:

   <class name="Root">
      <map-to xml="root" ns-prefix="xyz" ns-uri="http://www.acme.org/xyz"/>
      <field name="name" type="string">
            <bind-xml name="xyz:name" node="attribute"/>
      </field>
      <field name="child" type="Child">
            <bind-xml name="xyz:child" node="element"/>
      </field>
   </class>

This suggests I need to modify DescriptorSourceFactory.createDescriptor()
to:
 1. set the class descriptor nsPrefix field
 2. modify the xmlName parameter to the XMLFIeldDescriptorImpl constructor
to include the prefix.


I'd appreciate your guidance so I don't break something by making these
changes, or indeed, whether I am on the right track to begin with.


Regards & thanks in advance
Dean




>  -----Original Message-----
>  From: Keith Visco [mailto:[EMAIL PROTECTED]
>  Sent: Friday, 18 July 2003 10:54 AM
>  To: [EMAIL PROTECTED]
>  Subject: Re: [castor-dev] Mapping generated Castor classes
>  
>  
>  
>  
>  "Chalker, Dean" wrote:
>  > 
>  > Cool.  I am happy to use MappingTool, warts and all.  
>  Being a Castor-newbie
>  > (as you can tell from my postings) I wasn't sure whether I 
>  was seeing a
>  > short coming of the tool, or whether I just misunderstood again.
>  > 
>  > Would you encourage me to look at fixing the cst:ns-prefix 
>  and xsd:choice
>  > issues?  I would be happy to do so (assuming I can find 
>  the time :-), but
>  > perhaps not so interesting if you think my problems are 
>  not relevant to
>  > others.
>  
>  Any improvements over current limitations or bug fixes are always
>  welcome.
>  
>  --Keith
>  
>  ----------------------------------------------------------- 
>  If you wish to unsubscribe from this mailing, send mail to
>  [EMAIL PROTECTED] with a subject of:
>          unsubscribe castor-dev
>  

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to