Hello!

I faced with problem of resolving cyclic references in binding.xml.
I have xsd schema where element types ID and IDREF defined. After
generating java classes from this schema with xsd2jibx binding.xml is
also generated. But it cannot be compiled then. Giving a message 'No ID
definitions for compatible type..'
That happens because of cyclic reference to object in the nested
collection of this object.
<--XSD-->
<xsd:complexType name="Entity">
  <xsd:sequence>
      <xsd:element name="relation"  type="Relation"  minOccurs="0"
maxOccurs="unbounded"/>
 </xsd:sequence>
 <xsd:attribute name="name"      type="xsd:ID" use="required"/>
 <xsd:attribute name="className" type="xsd:string" use="required"/>
</xsd:complexType>
 
<xsd:complexType name="Relation">
  <xsd:attribute name="entityRef" type="xsd:IDREF" use="required"/>
   <xsd:attribute name="mode">
   <xsd:simpleType>
     <xsd:restriction base="xsd:string">
      <xsd:enumeration value="multiple"/>
      <xsd:enumeration value="single"/>
     </xsd:restriction>
   </xsd:simpleType>
  </xsd:attribute>
</xsd:complexType>
 
<--binding.xml-->
<?xml version="1.0" encoding="UTF-8"?>
<binding>
   <mapping name="entity" class="Entity">
      <collection field="relationList">
        <structure map-as="Relation"/>    
      </collection>
    <value ident="def" name="name" field="name" usage="required"
style="attribute"/> 
    <value name="className" field="className" usage="required"
style="attribute"/>
  </mapping>
  <mapping name="relation" class="Relation">
    <value ident="ref" name="entityRef" field="entityRef"
usage="required" style="attribute"/>
    <value name="mode" field="mode" usage="optional" style="attribute"/>
  </mapping> 
</binding>
 
Now when I try to call java -cp .:lib\Entity.jar:jibx-bind.jar
org.jibx.binding.Compile binding.xml I get a JIBXException: Binding
binding.xml in unusable because of validation errors.
 
Is there any method to resolve such cyclic references by binding
configuration ?
May be there is a way to disable validation of binding.xml ?
 
Thanks,
 
Elena Lukashevich 
E-mail: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>  
MSN Messenger: [EMAIL PROTECTED] 

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to