views:

344

answers:

0

I have an XML schema that has an element named Con, unfortunately con is an illegal file name on windows so when I use codegen to generated java classes it fails.

What I'm trying to do is get JIBX's codegen to rename the class but it doesn't seem to work.

This is JIBX 1.2.1

Example schema:

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://test.com/test/me" xmlns="http://test.com/test/me"
    elementFormDefault="qualified">

    <xs:complexType name="Con">
     <xs:attribute name="attr1" type="xs:double" use="required" />
     <xs:attribute name="attr2" type="xs:double" use="required" />
    </xs:complexType>

    <xs:element name="Con" type="Con" />

</xs:schema>

Any ideas? Example ant script:

<!-- generate default binding and schema -->
<target name="codegen">
 <delete dir="gen"/>
 <java classname="org.jibx.schema.codegen.CodeGen" fork="yes" classpathref="jibx.classpath" failonerror="true">
  <arg value="-t" />
  <arg value="gen/src" />

  <arg value="-c" />
  <arg value="custom.xml" />

  <arg value="src/main/xsd/Test.xsd" />
 </java>
</target>

Example custom.xml that I thought would fix the problem:

<schema-set prefer-inline="true" generate-all="true">
    <schema name="Test.xsd" >
     <element name="Con" class-name="Foo" />
    </schema>
</schema-set>