Hi Hima,

It's a bug. We have issues with duplicate names...even though they come
from
different namespaces.

We might be able to try using the namespace prefix as part of the field
name
in the Java class.

I've filled out a Bugzilla report. You can access the report here:

http://bugzilla.exolab.org/show_bug.cgi?id=867

Thanks,

--Keith

"Himagiri(Hima) Mukkamala" wrote:
> 
> I've tried to use SourceGenerator with the
> attached Schema.
> 
> Scheam has an element with 2 attributes, one with name=type and
> other a ref="xlink:type".
> 
> <attribute ref="xlink:type" fixed="simple"/>
> <attribute name="type" type="string"/>
> 
> When the name of the field is generated
> for java files, both the fields are mapped to _type and
> hence generate a "duplicate name _type" exception.
> 
> The actual exception is included below.
> 
> 1) Did  anyone else have to deal with this problem?
> 2) Has anybody looked at using namespace qualifiers for
> the field names?
> 
> thanks
> -hima
> 
> --------------Schema which causes the problem---------------------
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <schema targetNamespace="http://xyz.com/test.xsd";;
> xmlns:xml="http://www.w3.org/X
> ML/1998/namespace" xmlns="http://www.w3.org/2001/XMLSchema";;
> xmlns:xsi="http://ww
> w.w3.org/2001/XMLSchema-instance"
> xmlns:xlink="http://www.w3.org/1999/xlink";;>
>         <import namespace="http://www.w3.org/1999/xlink";;
> schemaLocation="xlink.x
> sd"/>
>         <import namespace="http://www.w3.org/XML/1998/namespace";;
> schemaLocation=
> "xml.xsd"/>
>         <element name="A">
>                 <complexType>
>                         <attribute ref="xlink:type" fixed="simple"/>
>                         <attribute name="type" type="string"/>
>                 </complexType>
>         </element>
> </schema>
> 
> ------------------------Exception that I see----------------------
> Exception in thread "main" java.lang.IllegalArgumentException: duplicate
> 
> name found: _type
>         at org.exolab.javasource.JClass.addField(JClass.java:242)
>         at
> org.exolab.castor.builder.FieldInfo.createJavaField(FieldInfo.java:15
> 5)
>         at
> org.exolab.castor.builder.SourceFactory.handleField(SourceFactory.jav
> a:1386)
>         at
> org.exolab.castor.builder.SourceFactory.processAttributes(SourceFacto
> ry.java:1352)
>         at
> org.exolab.castor.builder.SourceFactory.processComplexType(SourceFact
> ory.java:1296)
>         at
> org.exolab.castor.builder.SourceFactory.createSourceCode(SourceFactor
> y.java:243)
>         at
> org.exolab.castor.builder.SourceGenerator.createClasses(SourceGenerat
> or.java:753)
>         at
> org.exolab.castor.builder.SourceGenerator.createClasses(SourceGenerat
> or.java:707)
>         at
> org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenera
> tor.java:354)
>         at
> org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenera
> tor.java:412)
>         at
> org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenera
> tor.java:441)
>         at
> org.exolab.castor.builder.SourceGenerator.main(SourceGenerator.java:6
> 65)
> 
> --------------------------------------------------------------------------------
> 
> -----------------------------------------------------------
> 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