JAXB外部绑定文件错误



因此,我已经为Waterml2.xsd编写了一个外部绑定文件,到目前为止,我已经定义了[错误]属性"行",并且[错误]属性"标题"已定义。

修复了这些问题后,我现在遇到了多个与碰撞有关的问题。例如:

[error]一个具有相同名称的类/接口 " net.opengis.gml._3.seconddefindingparameter"已经在使用。用一个 班级定制以解决这一冲突。

[错误]两个声明在对象捕集类中引起碰撞。


这就是绑定文件的样子:

<bindings xmlns="http://java.sun.com/xml/ns/jaxb" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
<!-- In geometryPrimitives.xsd, fix so element and attribute both with name "rows" don't conflict -->
<bindings schemaLocation="http://schemas.opengis.net/gml/3.2.1/geometryPrimitives.xsd" version="3.2.1.2">
<bindings node="//xs:group/xs:sequence/xs:element[@name='rows']">
<property name="rowsElement"/>
</bindings>
</bindings>
<!-- In xlink.xsd, fix so element and attributes don't have the same "titles" conflict -->
<bindings schemaLocation="http://www.w3.org/1999/xlink.xsd" node="/xs:schema">
<schemaBindings>
<package name="net.opengis.wfs._2_1"/>
</schemaBindings>
</bindings>
<bindings schemaLocation="http://www.w3.org/1999/xlink.xsd" node="/xs:schema">
<bindings node="//xs:attributeGroup[@name='locatorAttrs']">
<bindings node=".//xs:attribute[@ref='xlink:title']">
<property name="LocatorAttrsTitle"/>
</bindings>
</bindings>
<bindings node="//xs:group[@name='locatorModel']">
<bindings node=".//xs:element[@ref='xlink:title']">
<property name="LocatorModelTitle"/>
</bindings>
</bindings>
<bindings node="//xs:attributeGroup[@name='arcAttrs']">
<bindings node=".//xs:attribute[@ref='xlink:title']">
<property name="ArcAttrsTitle"/>
</bindings>
</bindings>
<bindings node="//xs:group[@name='arcModel']">
<bindings node=".//xs:element[@ref='xlink:title']">
<property name="ArcModelTitle"/>
</bindings>
</bindings>
</bindings>
</bindings>

如果有人提出任何建议或处理了WaterML 2.0模式,则在我感谢您的帮助之前!谢谢。

OGC模式需要一些其他绑定信息才能正确运行JAXB。依靠https://github.com/highsource/ogc-schemas的辛勤工作,您会更好。

要使用Highsource Bindings,最好只是克隆存储库并使用Maven来构建绑定(该项目中有很好的Maven Build Support)。IE。

git clone https://github.com/highsource/ogc-schemas.git
mvn install –D skipTests

我跳过了测试来加快速度,我遇到了一个测试失败的问题。

您还可以将基本pom.xml导入蚀(或您使用的任何IDE),然后让Maven构建进行。

构建后,您应该在相关文件夹下的绑定。例如。Waterml2.0:

ls waterml/2.0/target/generated-sources/xjc/net/opengis/waterml/v_2_0/
CategoricalTVPType.java
CategoricalTimeseriesType.java
CollectionPropertyType.java
CollectionType.java
CommentBlockPropertyType.java
and so on..

,目标/类文件夹中有一个XJB文件。

相关内容

最新更新