[英]Using JAXB to load FpML 5.7 using Maven
I have been struggling to generate java files from FpML 5.7 recordkeeping recommendation. 我一直在努力从FpML 5.7记录保存建议中生成Java文件。 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. 我遵循了http://www.stephennimmo.com/generate-java-objects-for-fpml-using-jaxb-and-maven-the-easy-way/和FpML 5.3 JAXB绑定 ,但仍然出现以下错误。
Here is my bindings.xjb 这是我的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. 这是我的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. 我还尝试将
<xjc:simple />
添加到绑定中,但这无济于事。 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. 我知道FpML网站的xsd文件中存在重复的对象定义,但是我如何扩展绑定以仍然保持xsd的真实性。 As this file is a market standard, I do not want to change the xsd.
由于此文件是市场标准,因此我不想更改xsd。
Thanks for your help. 谢谢你的帮助。
Added following lines in bindings.xjb to override names. 在bindings.xjb中添加了以下几行以覆盖名称。 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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.