拥有这个.xjb文件后,Eclipse会发现它无法找到元素 jaxb:bindings 。这是从哪里来的?
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings xmlns="http://java.sun.com/xml/ns/jaxb"
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd" version="2.1">
<jaxb:globalBindings>
<jaxb:serializable uid="1" />
<xjc:javaType name="java.lang.Integer" xmlType="xs:int"
adapter="com.foo.bar.jaxb.adapter.IntegerAdapter" />
<xjc:javaType name="java.lang.Integer" xmlType="xs:integer"
adapter="com.foo.bar.jaxb.adapter.IntegerAdapter" />
<xjc:javaType name="java.util.Date" xmlType="xs:time"
adapter="com.foo.bar.jaxb.adapter.TimeAdapter" />
<xjc:javaType name="java.util.Date" xmlType="xs:date"
adapter="com.foo.bar.jaxb.adapter.DateAdapter" />
<xjc:javaType name="java.util.Date" xmlType="xs:dateTime"
adapter="com.foo.bar.jaxb.adapter.DateTimeAdapter" />
</jaxb:globalBindings>
</jaxb:bindings>
Eclipse在第9行抱怨:
cvc-elt.1:找不到元素的声明&#39; jaxb:bindings&#39;。
为什么......我怎么能解决这个问题?
答案 0 :(得分:1)
我在我的项目中使用此配置..( maven&amp; maven-jaxb2-plugin )
<bindings version="2.0" xmlns="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"
xmlns:annox="http://annox.dev.java.net">
<globalBindings>
<xjc:serializable uid="12343" />
<xjc:simple/>
</globalBindings>
</bindings>
删除架构位置声明。