错误] s4s-elt-schema-ns:'绑定的命名空间'必须来自架构命名空间,http://www.w3.org/2001/XMLSchema'

时间:2012-03-29 11:35:35

标签: java jaxb xml-parsing

编译我的jaxb文件时遇到以下错误。

C:\bea\jdk160_05\bin>xjc cmf.jaxb
parsing a schema...
[ERROR] s4s-elt-schema-ns: The namespace of element 'bindings' must be from the schema namespace, 'http://www.w3.org/2001/XMLSchema'.
  line 2 of file:/C:/bea/jdk160_05/bin/cmf.jaxb

JaxB文件

<?xml version='1.0'?>
<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="2.1"> 
    <bindings schemaLocation="bi-cmf-flat_V1_0.xsd" >
        <!-- rename the value element -->
        <bindings node="//xs:complexType[@name='DeductibleType']">          
            <class name="DeductibleTypeAttribute"/>
        </bindings>
    </bindings>
</bindings>

1 个答案:

答案 0 :(得分:1)

XJC调用的格式为:

xjc -b <bindinfo> <schema>

这意味着您的XJC呼叫应该是:

xjc -b cmf.jaxb bi-cmf-flat_V1_0.xsd

示例