【问题标题】:XML namespace issue with xjb binding filexjb 绑定文件的 XML 命名空间问题
【发布时间】:2014-02-27 12:59:36
【问题描述】:

我有 以下 xml 文件:

<?xml version="1.0" encoding="UTF-8"?>
<bindings xmlns="http://java.sun.com/xml/ns/jaxb" 
          xmlns:xs="http://www.w3.org/2001/XMLSchema" 
          targetNamespace="http://java.sun.com/xml/ns/jaxb"
          version="2.1">
    <bindings xs:schemaLocation="Inbound.wsdl#wsdl:types" node="/schema">
        <bindings node="//complexType[@name='TradeIdWithRef']">
            <bindings node=".//attribute[@name='_value']">
                <property name="ValueAttribute"/>
            </bindings>
        </bindings>
        <bindings node="//complexType[@name='Bank']">
            <bindings node=".//attribute[@name='_value']">
                <property name="ValueAttribute"/>
            </bindings>
        </bindings>
        <bindings node="//complexType[@name='Bid']">
            <bindings node=".//attribute[@name='_value']">
                <property name="ValueAttribute"/>
            </bindings>
        </bindings>
        <bindings node="//complexType[@name='addMarketExRequest']">
            <bindings node=".//attribute[@name='_value']">
                <property name="ValueAttribute"/>
            </bindings>
        </bindings>
        <bindings node="//complexType[@name='Offer']">
            <bindings node=".//attribute[@name='_value']">
                <property name="ValueAttribute"/>
            </bindings>
        </bindings>
        <bindings node="//complexType[@name='Price']">
            <bindings node=".//attribute[@name='_value']">
                <property name="ValueAttribute"/>
            </bindings>
        </bindings>
        <bindings node="//complexType[@name='Delta']">
            <bindings node=".//attribute[@name='_value']">
                <property name="ValueAttribute"/>
            </bindings>
        </bindings>
    </bindings>
</bindings>

但是,我在 xml 验证时总是收到以下错误:

cvc-elt.1: Cannot find the declaration of element 'bindings'. [5]

有人可以帮忙吗?

【问题讨论】:

  • 架构是什么样的?

标签: xml xml-namespaces


【解决方案1】:

schemaLocation 属性必须包含架构的命名空间架构定义文件的路径separated by whitespace

另外,我不肯定这是一个错误,但我不知道你为什么要在子节点而不是根节点上声明 schemaLocation

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多