Hi, I am not sure whether it would be possible to rename one of the redundant attributes with a binding file, as I am not sure whether the check that actually generates the complaint you have seen happens before or after evaluating the binding file ? Have you tried this at all ?
Werner climbingrose wrote: > I'm able to generate source code using XmlBeans without any extra effort. I'm > also able to generate the code with JAXB using a binding file. I like the > approach of JAXB which allows you to change the name of the attribute to > avoid name collision. I really like to use Castor but it seems that I have > to choose either JAXB or XmlBeans. > > > Werner Guttmann wrote: >> In the XML schema. As pointed out by Eddie, it is illegal to have two >> attributes with the same name defined within a type. And that's exactly >> what happens in some cases within your XML schema. >> >> Though, as added by myself, we have to be very precise about the use of >> namespaces in the context of this discussion. >> >> Werner >> >> climbingrose wrote: >>> Thanks for your replies guys. I'm still in the process of learning XML to >>> tackle this problem. Where does the problem lie? In schema itself or >>> Castor? >>> Thanks. >>> >>> >>> >>> Werner Guttmann wrote: >>>> Hi Edward, >>>> >>>> I had a very detailed look at the schemas in question, and I think that >>>> we have to very carefully look the >>>> >>>> a) namespaces of the XMK schema >>>> b) attributeFormDefault values used >>>> >>>> My initial assessment was that we are talking about dups, but I am not >>>> sure any more. >>>> >>>> Werner >>>> >>>> Kuns, Edward wrote: >>>>> You cannot have a redundant attribute defined in a type. If an >>>>> attributeGroup defines an attribute "type" and that attributeGroup is >>>>> included in a complexType that includes an attribute also named "type" >>>>> -- >>>>> assuming both are in the same namespace -- then you have an illegal >>>>> schema. >>>>> >>>>> Eddie >>>>> >>>>> >>>>> -----Original Message----- >>>>> From: Werner Guttmann [mailto:[EMAIL PROTECTED] >>>>> Sent: Fri 1/26/2007 2:41 PM >>>>> To: [email protected] >>>>> Subject: Re: [castor-user] SourceGenerator and MODS schema >>>>> >>>>> Hi, >>>>> >>>>> I just had a second look at the XML schema given, and there's a complex >>>>> type definition >>>>> >>>>> <xsd:complexType name="nameType"> >>>>> <xsd:choice minOccurs="0" maxOccurs="unbounded"> >>>>> <xsd:element name="namePart" type="namePartType"/> >>>>> <xsd:element name="displayForm"> >>>>> <xsd:annotation> >>>>> >>>>> <xsd:documentation>245$c</xsd:documentation> >>>>> </xsd:annotation> >>>>> </xsd:element> >>>>> <xsd:element name="affiliation" type="xsd:string"> >>>>> <xsd:annotation> >>>>> <xsd:documentation>100, 700 >>>>> $u</xsd:documentation> >>>>> </xsd:annotation> >>>>> </xsd:element> >>>>> <xsd:element name="role" type="roleType"/> >>>>> <xsd:element name="description" type="xsd:string"/> >>>>> </xsd:choice> >>>>> <xsd:attribute name="ID" type="xsd:ID" use="optional"/> >>>>> <xsd:attribute name="type" type="nameTypeAttribute" >>>>> use="optional"/> >>>>> <xsd:attribute name="authority" use="optional" >>>>> type="xsd:string"> >>>>> <xsd:annotation> >>>>> <xsd:documentation>Value is from the list at >>>>> >>>>> http:/www.loc.gov/marc/sourcecode/authorityfile/authorityfilesource.html >>>>> </xsd:documentation> >>>>> </xsd:annotation> >>>>> </xsd:attribute> >>>>> <xsd:attributeGroup ref="xlink:simpleLink"/> >>>>> <xsd:attributeGroup ref="language"/> >>>>> </xsd:complexType> >>>>> >>>>> that seems to be causing the problems. It looks like this complex type >>>>> declares an attribute named "type" and at the same type references an >>>>> attribute group "xlink:simpleLink" that includes an attribute named >>>>> "type. >>>>> >>>>> Let me ponder a bit on what the XML schema specification has to say on >>>>> this. >>>>> >>>>> Regards >>>>> Werner >>>>> >>>>> climbingrose wrote: >>>>>> Hi, >>>>>> >>>>>> I'm trying to generate java source for MODS (Metadata Object >>>>>> Description >>>>>> Schema) using the included SourceGenerator. The schema is located >>>>>> here: >>>>>> http://www.loc.gov/standards/mods/v3/mods-3-2.xsd. I got the following >>>>>> error: >>>>>> >>>>>> 12:39:33,187 WARN SourceGenerator:731 - Warning: Do not forget to >>>>>> generate >>>>>> source code for the following imported schema: >>>>>> http://www.loc.gov/standards/xlink.xsd >>>>>> 12:39:33,190 WARN SourceGenerator:731 - Warning: Do not forget to >>>>>> generate >>>>>> source code for the following imported schema: >>>>>> http://www.w3.org/2001/xml.xsd >>>>>> >>>>>> com/test/Mods.java already exists. overwrite(y|n|a|?)a >>>>>> >>>>>> java.lang.IllegalArgumentException: Duplicate name found as a class >>>>>> member: >>>>>> _type >>>>>> at org.exolab.javasource.JClass.addField(JClass.java:172) >>>>>> at >>>>>> org.exolab.castor.builder.FieldInfo.createJavaField(FieldInfo.java:183) >>>>>> at >>>>>> org.exolab.castor.builder.SourceFactory.handleField(SourceFactory.java:1916) >>>>>> at >>>>>> org.exolab.castor.builder.SourceFactory.processAttributes(SourceFactory.java:1554) >>>>>> at >>>>>> org.exolab.castor.builder.SourceFactory.processComplexType(SourceFactory.java:1674) >>>>>> at >>>>>> org.exolab.castor.builder.SourceFactory.processComplexType(SourceFactory.java:633) >>>>>> at >>>>>> org.exolab.castor.builder.SourceFactory.createSourceCode(SourceFactory.java:340) >>>>>> at >>>>>> org.exolab.castor.builder.SourceGenerator.processComplexType(SourceGenerator.java:903) >>>>>> at >>>>>> org.exolab.castor.builder.SourceGenerator.generateAllClassFiles(SourceGenerator.java:693) >>>>>> at >>>>>> org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:654) >>>>>> at >>>>>> org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:595) >>>>>> at >>>>>> org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:497) >>>>>> at >>>>>> org.exolab.castor.builder.SourceGeneratorMain.main(SourceGeneratorMain.java:245) >>>>>> >>>>>> Any ideas? >>>>>> >>>>>> Thanks. >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe from this list please visit: >>>>> >>>>> http://xircles.codehaus.org/manage_email >>>>> >>>>> >>>>> >>>>> >>>>> ------------------------------------------------------------------------ >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe from this list please visit: >>>>> >>>>> http://xircles.codehaus.org/manage_email >>>> --------------------------------------------------------------------- >>>> To unsubscribe from this list please visit: >>>> >>>> http://xircles.codehaus.org/manage_email >>>> >>>> >>>> >> >> --------------------------------------------------------------------- >> To unsubscribe from this list please visit: >> >> http://xircles.codehaus.org/manage_email >> >> >> > --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email

