Java 为生成JAXB类http://schemas.opengis.net/wfs/1.1.0/wfs.xsd
我正在尝试使用JAXB为该模式生成类: 我将该模式下载到一个本地文件中,现在我正在尝试生成JAXB类。首先我得到了这个错误:Java 为生成JAXB类http://schemas.opengis.net/wfs/1.1.0/wfs.xsd,java,xsd,jaxb,ogc,opengis,Java,Xsd,Jaxb,Ogc,Opengis,我正在尝试使用JAXB为该模式生成类: 我将该模式下载到一个本地文件中,现在我正在尝试生成JAXB类。首先我得到了这个错误: [ERROR] Property "Title" is already defined. Use <jaxb:property> to resolve this conflict. line 261 of http://www.w3.org/1999/xlink.xsd 在谷歌搜索之后,我发现我需要使用一个绑定文件: <jxb:bindin
[ERROR] Property "Title" is already defined. Use <jaxb:property> to resolve this conflict.
line 261 of http://www.w3.org/1999/xlink.xsd
在谷歌搜索之后,我发现我需要使用一个绑定文件:
<jxb:bindings version="2.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<jxb:bindings schemaLocation="http://www.w3.org/1999/xlink.xsd"
node="/xs:schema">
<jxb:bindings node="//xs:attributeGroup[@name='locatorAttrs']">
<jxb:bindings node=".//xs:attribute[@ref='xlink:title']">
<jxb:property name="title1" />
</jxb:bindings>
</jxb:bindings>
<jxb:bindings node="//xs:attributeGroup[@name='arcAttrs']">
<jxb:bindings node=".//xs:attribute[@ref='xlink:title']">
<jxb:property name="title2" />
</jxb:bindings>
</jxb:bindings>
</jxb:bindings>
<jxb:bindings
schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/geometryPrimitives.xsd"
node="/xs:schema">
<jxb:bindings node="//xs:element[@name='_Solid']">
<jxb:factoryMethod name="gmlAbstractSolidElementFactory" />
</jxb:bindings>
</jxb:bindings>
</jxb:bindings>
我有点惊讶,只是因为这看起来像是一个其他人会为其生成JAXB类的模式,但谷歌似乎什么都没发现。我以前使用过JAXB,但这似乎比我过去看到的要复杂得多
是否有一个特定的绑定文件需要用于此模式,或者某些特定的JAXB设置?免责声明:我是该项目的主要开发人员,该项目编译了几乎所有的OGC模式,包括 OGC模式在编译时相当困难。您需要大量绑定、自定义,有时还需要修补程序。因此,我的建议是只使用项目提供的已编译的SCHMEA。获取已编译的WFS 1.1.0架构 对于WFS 1.1.0,您需要一些绑定:
但是,实际上,只需使用已编译的模式即可。这就是这个项目的内容。@laune这些是预先存在的模式,所以我无法更改它们。我想我在问这些绑定或补丁是什么。很高兴知道。这些年来,我至少还有一个关于这些XSD的投诉。-如果xsd文件不能在不损害XML结构的情况下进行修补,则xsd文件中应该有一条注释(“不要xjc,使用…”)。@laune修补程序大部分都是琐碎的(URL更正),但有几件事只是为了让xjc高兴。据我所知,XML结构基本上是相同的,或者至少是紧密兼容的。@lexicore这看起来很有希望。我现在不能使用maven(一定很喜欢公司防火墙),所以我尝试使用您的绑定文件自己生成JAXB类。我收到以下错误:
不支持的绑定命名空间“http://jaxb2-commons.dev.java.net/basic/wildcard". 也许你的意思是“http://jaxb.dev.java.net/plugin/code-injector"? 第2行http://schemas.opengis.net/gml/3.1.1/base/feature.xsd
@KevinWorkman您不必使用Maven。下载罐子就行了。这是我的名片。你还需要。但事实上,经过一些修补,我终于让它工作了。非常感谢!OpenGIS使用如此复杂的模式似乎有点疯狂。。。
parsing a schema...
compiling a schema...
[ERROR] A class/interface with the same name "ncr.request.FeatureCollectionType" is already in use. Use a class customization to resolve this conflict.
line 846 of file:/C:/Users/kworkman/workspace/NcrApi/schemas/request2/wfs.xsd
[ERROR] (Relevant to above error) another "FeatureCollectionType" is generated from here.
line 117 of http://schemas.opengis.net/gml/3.1.1/base/feature.xsd
[ERROR] A class/interface with the same name "ncr.request.ArcType" is already in use. Use a class customization to resolve this conflict.
line 217 of http://schemas.opengis.net/gml/3.1.1/base/geometryPrimitives.xsd
[ERROR] (Relevant to above error) another "ArcType" is generated from here.
line 265 of http://www.w3.org/1999/xlink.xsd
[ERROR] A class/interface with the same name "ncr.request.CodeType" is already in use. Use a class customization to resolve this conflict.
line 162 of http://schemas.opengis.net/gml/3.1.1/base/basicTypes.xsd
[ERROR] (Relevant to above error) another "CodeType" is generated from here.
line 49 of http://schemas.opengis.net/ows/1.0.0/ows19115subset.xsd
[ERROR] A class/interface with the same name "ncr.request.GetCapabilitiesType" is already in use. Use a class customization to resolve this conflict.
line 168 of file:/C:/Users/kworkman/workspace/NcrApi/schemas/request2/wfs.xsd
[ERROR] (Relevant to above error) another "GetCapabilitiesType" is generated from here.
line 40 of http://schemas.opengis.net/ows/1.0.0/owsGetCapabilities.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 846 of file:/C:/Users/kworkman/workspace/NcrApi/schemas/request2/wfs.xsd
[ERROR] (Related to above error) This is the other declaration.
line 117 of http://schemas.opengis.net/gml/3.1.1/base/feature.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 217 of http://schemas.opengis.net/gml/3.1.1/base/geometryPrimitives.xsd
[ERROR] (Related to above error) This is the other declaration.
line 265 of http://www.w3.org/1999/xlink.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 162 of http://schemas.opengis.net/gml/3.1.1/base/basicTypes.xsd
[ERROR] (Related to above error) This is the other declaration.
line 49 of http://schemas.opengis.net/ows/1.0.0/ows19115subset.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 168 of file:/C:/Users/kworkman/workspace/NcrApi/schemas/request2/wfs.xsd
[ERROR] (Related to above error) This is the other declaration.
line 40 of http://schemas.opengis.net/ows/1.0.0/owsGetCapabilities.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 1088 of http://schemas.opengis.net/gml/3.1.1/base/geometryPrimitives.xsd
[ERROR] (Related to above error) This is the other declaration.
line 90 of http://schemas.opengis.net/gml/3.1.1/base/geometryBasic2d.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 838 of file:/C:/Users/kworkman/workspace/NcrApi/schemas/request2/wfs.xsd
[ERROR] (Related to above error) This is the other declaration.
line 99 of http://schemas.opengis.net/gml/3.1.1/base/feature.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 167 of file:/C:/Users/kworkman/workspace/NcrApi/schemas/request2/wfs.xsd
[ERROR] (Related to above error) This is the other declaration.
line 38 of http://schemas.opengis.net/ows/1.0.0/owsGetCapabilities.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 99 of http://schemas.opengis.net/gml/3.1.1/base/feature.xsd
[ERROR] (Related to above error) This is the other declaration.
line 115 of http://schemas.opengis.net/gml/3.1.1/base/feature.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 298 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
[ERROR] (Related to above error) This is the other declaration.
line 317 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 24 of http://schemas.opengis.net/ows/1.0.0/ows19115subset.xsd
[ERROR] (Related to above error) This is the other declaration.
line 167 of http://www.w3.org/1999/xlink.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 257 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
[ERROR] (Related to above error) This is the other declaration.
line 276 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 102 of http://schemas.opengis.net/gml/3.1.1/smil/smil20-language.xsd
[ERROR] (Related to above error) This is the other declaration.
line 136 of http://schemas.opengis.net/gml/3.1.1/smil/smil20.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 206 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
[ERROR] (Related to above error) This is the other declaration.
line 225 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 124 of http://schemas.opengis.net/gml/3.1.1/smil/smil20.xsd
[ERROR] (Related to above error) This is the other declaration.
line 70 of http://schemas.opengis.net/gml/3.1.1/smil/smil20-language.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 18 of http://schemas.opengis.net/gml/3.1.1/base/geometryBasic2d.xsd
[ERROR] (Related to above error) This is the other declaration.
line 925 of http://schemas.opengis.net/gml/3.1.1/base/geometryPrimitives.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 65 of http://schemas.opengis.net/gml/3.1.1/smil/smil20.xsd
[ERROR] (Related to above error) This is the other declaration.
line 34 of http://schemas.opengis.net/gml/3.1.1/smil/smil20-language.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 215 of http://schemas.opengis.net/gml/3.1.1/base/geometryPrimitives.xsd
[ERROR] (Related to above error) This is the other declaration.
line 241 of http://www.w3.org/1999/xlink.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 17 of http://schemas.opengis.net/gml/3.1.1/base/geometryPrimitives.xsd
[ERROR] (Related to above error) This is the other declaration.
line 287 of http://schemas.opengis.net/gml/3.1.1/base/geometryBasic0d1d.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 24 of http://schemas.opengis.net/filter/1.1.0/expr.xsd
[ERROR] (Related to above error) This is the other declaration.
line 89 of file:/C:/Users/kworkman/workspace/NcrApi/schemas/request2/wfs.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 86 of http://schemas.opengis.net/gml/3.1.1/smil/smil20-language.xsd
[ERROR] (Related to above error) This is the other declaration.
line 130 of http://schemas.opengis.net/gml/3.1.1/smil/smil20.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 68 of http://schemas.opengis.net/ows/1.0.0/owsCommon.xsd
[ERROR] (Related to above error) This is the other declaration.
line 188 of http://schemas.opengis.net/gml/3.1.1/base/referenceSystems.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 78 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
[ERROR] (Related to above error) This is the other declaration.
line 97 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 174 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
[ERROR] (Related to above error) This is the other declaration.
line 155 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 41 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
[ERROR] (Related to above error) This is the other declaration.
line 56 of http://schemas.opengis.net/gml/3.1.1/base/defaultStyle.xsd
Failed to produce code.