【问题标题】:xpath: prefix must resolve to a namespace:xsdxpath:前缀必须解析为命名空间:xsd
【发布时间】:2020-03-15 08:04:13
【问题描述】:

我是使用 jaxb2 的新手。我收到此错误:“xpath:前缀必须解析为命名空间:xsd”,我不知道如何修复它。 这是因为我有两个 xsd 文件试图设计同一个类但在我的 java 应用程序的不同包中

<jxb:bindings schemaLocation="../documentazione/xsd/Global/datatypes_global_v62.xsd">

        <jxb:schemaBindings>
            <jxb:package name="com.companyname.plugin.entities.global" />
        </jxb:schemaBindings>

        <jxb:bindings node="//xsd:complexType[@name='Contact']">
            <jxb:class name="GlobalContact" />
        </jxb:bindings>

    </jxb:bindings>


    <jxb:bindings schemaLocation="../documentazione/xsd/Global/pickupdatatypes_global-3.0.xsd">
        <jxb:schemaBindings>
            <jxb:package name="com.companyname.plugin.entities.pickup" />
        </jxb:schemaBindings>
        <jxb:bindings node="xsd://complexType[@name='contact']" >
            <jxb:class name="Contact" />
        </jxb:bindings>
    </jxb:bindings>

我已经尝试运行插件,但我不知道如何修复错误。

【问题讨论】:

    标签: java maven binding namespaces jaxb


    【解决方案1】:

    我该如何解决这个问题? 简单的!在我使用的 xjb 文件的名称空间中:

        xmlns:xs="http://www.w3.org/2000/10/XMLSchema-instance"
        xs:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd">```
    
    And this was fine for most of my xjb files, but in my case I want to use complexType node. In this case I have to use: 
    ```<jxb:bindings version="2.0"  xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:xs="http://www.w3.org/2000/10/XMLSchema-instance"
        xs:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd">```
    
    the `xmlns:xsd="http://www.w3.org/2001/XMLSchema` help me to fix all my issue.
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-17
      • 2014-02-06
      • 2014-02-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多