Hi Alex,

Should be fixed in the 1.2.2 code (which you can try out by downloading 
the 1.2.2SNAPSHOT jars from the Maven(1) repository, at 
http://jibx.sourceforge.net/maven/jibx/jars/ ). It was solved by 
checking for an empty name string and substituting "_" as the name 
(while keeping the empty string as the value).

  - Dennis

Dennis M. Sosnoski
XML and Web Services in Java
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117



Alx wrote:
> Hi all,
>
> I have a xsd which contains among others an element of the form:
>
> <xs:element name="KLADOS">
>         <xs:simpleType>
>             <xs:restriction base="xs:string">
>                * <xs:enumeration value=""/>*
>                 <xs:enumeration value="01"/>
>                 <xs:enumeration value="03"/>
>                 <xs:enumeration value="05"/>
>             </xs:restriction>
>         </xs:simpleType>
>     </xs:element>
>
> When I run codegen the following exception is thrown:
>
> Exception in thread "main" java.lang.IllegalArgumentException
>         at 
> org.eclipse.jdt.core.dom.SimpleName.setIdentifier(SimpleName.java:189)
>         at org.eclipse.jdt.core.dom.AST.newSimpleName(AST.java:1251)
>         at 
> org.jibx.schema.codegen.ClassBuilder.addField(ClassBuilder.java:442)
>         at 
> org.jibx.schema.codegen.ClassBuilder.addField(ClassBuilder.java:457)
>         at 
> org.jibx.schema.codegen.EnumerationClassHolder.buildSimpleEnumeration(EnumerationClassHolder.java:209)
>         at 
> org.jibx.schema.codegen.EnumerationClassHolder.generate(EnumerationClassHolder.java:164)
>         at 
> org.jibx.schema.codegen.ClassHolder.generateInner(ClassHolder.java:702)
>         at 
> org.jibx.schema.codegen.StructureClassHolder.generate(StructureClassHolder.java:2026)
>         at 
> org.jibx.schema.codegen.PackageHolder.generate(PackageHolder.java:203)
>         at 
> org.jibx.schema.codegen.PackageHolder.generate(PackageHolder.java:218)
>         at org.jibx.schema.codegen.CodeGen.generate(CodeGen.java:1402)
>         at org.jibx.schema.codegen.CodeGen.main(CodeGen.java:1652)
>
> When I add a space to the empty value like this:
>
> * *<xs:enumeration value=*" "*/>
>
> the codegen works correctly.
>
> Of course, when I unmarshal a document which has an empty value for 
> this element e.g.:
>
> <KLADOS/>
>
> I have an exception and to make it work I have to change the above to:
>
> <KLADOS>  </KLADOS>
>
> A space in between tags.
>
> My problem is that I cannot change the xsd or the xmls, because they 
> are both generated by my client.
>
> Is there any workaround for this?
>
> Thank you in advance.
>
> Alex
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay 
> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
> http://p.sf.net/sfu/devconf
> ------------------------------------------------------------------------
>
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>   

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to