0

I have been struggling to generate java files from FpML 5.7 recordkeeping recommendation. Any help is appriciated.

I have followed http://www.stephennimmo.com/generate-java-objects-for-fpml-using-jaxb-and-maven-the-easy-way/ and FpML 5.3 JAXB Bindings and still I am getting following error.

  • You are getting this "catch-all" property because of the following reason:
    • The field name "NotionalSchedule" is used by two different parts of a schema. See:
    • line 69 of file:/C:/Projects/TestFpML/src/main/xsd/xml_recordkeeping/fpml-ird-5-7.xsd
    • line 53 of file:/C:/Projects/TestFpML/src/main/xsd/xml_recordkeeping/fpml-ird-5-7.xsd

Here is my bindings.xjb

<?xml version="1.0" encoding="UTF-8"?>
<jxb:bindings xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
            xmlns:xs="http://www.w3.org/2001/XMLSchema"            
            xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
            xs:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd" 
            version="2.1" 
            jxb:extensionBindingPrefixes="xjc">
    <jxb:globalBindings>
        <jxb:serializable uid="54"/>
    </jxb:globalBindings>
</jxb:bindings>

And here is my maven pom.xml.

<plugin>

    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jaxb2-maven-plugin</artifactId>
    <version>1.5</version>              
    <executions>
        <execution>
            <id>xml_recordkeeping-xjc</id>                      
            <goals>
                <goal>xjc</goal>
            </goals>
            <configuration>                                 
                <schemaDirectory>${project.basedir}/src/main/xsd/xml_recordkeeping</schemaDirectory>
                <bindingDirectory>${project.basedir}/src/main/xjb</bindingDirectory>
                <bindingFiles>bindings.xjb</bindingFiles>
                <schemaFiles>fpml-main-5-7.xsd</schemaFiles>
                <packageName>org.fpml.recordkeeping</packageName>
                <staleFile>${project.build.directory}/jaxb2/.recordkeepingXjcStaleFlag</staleFile>
                <extension>true</extension>
            </configuration>
        </execution>
    </executions>
    <configuration>
        <outputDirectory>${project.basedir}/src/main/java</outputDirectory>                 
    </configuration>
</plugin>

I also tried to add <xjc:simple /> to the bindings but it does not help. I understand that there is a duplicate object definition in the xsd file from FpML website, but how can I extend the bindings to still maintain the authenticity of the xsd. As this file is a market standard, I do not want to change the xsd.

Thanks for your help.

Community
  • 1
  • 1
mediumpike
  • 33
  • 7

1 Answers1

1

Added following lines in bindings.xjb to override names. Did the trick.

<jxb:bindings schemaLocation="../xsd/xml_recordkeeping/fpml-ird-5-7.xsd">
    <jxb:bindings node="//xs:complexType[@name='Calculation']/xs:sequence/xs:choice/xs:element[@name='notionalSchedule']">
        <jxb:property name="notionalScheduleOld"/>
    </jxb:bindings>
</jxb:bindings>

Thanks lexicore!

Community
  • 1
  • 1
mediumpike
  • 33
  • 7