Hi,
 
I've run into a problem with the code generated from a group in an XML schema. The offending element is:
 
   <xsd:group name="grp.any">
      <xsd:annotation>
         <xsd:documentation>Any namespaced element from any namespace may be inc
luded within an &quot;any&quot; element.  The namespace for the imported element
 must be defined in the instance, and the schema must be imported.  </xsd:docume
ntation>
      </xsd:annotation>
      <xsd:sequence>
         <xsd:any namespace="##other" processContents="strict" minOccurs="0" max
Occurs="unbounded"/>
      </xsd:sequence>
   </xsd:group>
 
(It's actually from the IMS Global Learning Consortium content packaging schema, if anyone's interested. I've noticed messages about this posted on the list before, but as far as can see, it's still an outstanding issue).
 
It seems that castor generates a 'dummy' XMLFieldDescriptor instance for the group, with the name '-error-if-this-is-used-'. Unfortunately, the XMLFieldDescriptor has it's 'required' attribute set to true, so during validation, castor wants there to be an element of that name and complains.
 
I've tried to fix my own build of castor by modifying the org.exolab.castor.xml.schema.Group class to set it's 'minOccurs' attribute to 0, rather than the default of 1. This prevents the 'required' attribute from being set and everything seems to be fine.
 
Unfortunately I'm new to the castor code and I have no idea if this is really the right way to go. I wonder if anyone else on the list could comment? I'd be very grateful for any pointers on this.
 
Thanks,
Jack

Reply via email to