0
我的项目生成以下文件:然后消除产生XJB文件错误
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings
xmlns:jaxb="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:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:annox="http://annox.dev.java.net"
xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
jaxb:extensionBindingPrefixes="xjc annox"
version="2.1">
<!-- from codereview.stackexchange.com/questions/1877/jaxxb-xjc-code-generation-adding-xmlrootelement-and-joda-datetime -->
<!-- Application of annotations to selected classes within schemas -->
<!-- org.example.SomeRootType @XmlRootElement -->
<jaxb:bindings schemaLocation="domain1.xsd" node="/xs:schema">
<jaxb:bindings node="xs:complexType[@name='SomeRootType']">
<annox:annotate>
<annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement" name="SomeRootType"/>
</annox:annotate>
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>
Eclipse在报告错误 “JAXB:extensionBindingPrefixes” 行
CVC-复杂type.3.2。 2:属性'jaxb:extensionBindingPrefixes'不允许出现在元素 'jaxb:bindings'中。
我不知道用什么工具生成文件; annox.dev.java.jet似乎是允许使用注释的子工具,但我无法找到项目中生成或使用注释的任何XML文件。
有人能告诉我如何摆脱错误,或至少是错误信息?我讨厌在我的项目中留下错误标记,并不表示真正的错误;它让我很难注意到当我真的有一个错误。
我试过了,但这是* GENERATED *文件。像我一样生成,我没有写,也不能改变它的样子。 – arcy
您可以使用XSLT或类似的方法后处理生成的文件。 – lexicore