【问题标题】:Selecting xsd:element from complexType with SCD使用 SCD 从 complexType 中选择 xsd:element
【发布时间】:2016-08-26 09:02:24
【问题描述】:

我正在尝试使用 SCD 选择 complexType 的子元素,但 SCD 选择了 complexType。 SCD 文档很差,我不明白如何正确选择子元素。 这里是 XSD sn-p:

<xsd:complexType name="request">
      <xsd:sequence>
          <xsd:element form="unqualified"
                        maxOccurs="unbounded" minOccurs="0" name="partner"
                        type="ns1:Partner" />
          <xsd:element form="unqualified"
                        maxOccurs="unbounded" minOccurs="0" name="foo"
                        type="xsd:anyType" />
          <xsd:element form="unqualified"
                        maxOccurs="unbounded" minOccurs="0" name="foo2"
                        type="xsd:anyType" />    
      </xsd:sequence>
</xsd:complexType>

我编写了以下绑定:

<bindings scd="x-schema::tns" xmlns:tns="http:/mynamespace.com/xsd">
    <schemaBindings>
       <package name="com.otherpackage.xsd" />
    </schemaBindings>
    <bindings scd="/~tns:request:schemaElement:foo">
           <class ref="com.othernamespace.OhterFoo" />
    </bindings>
    <bindings scd="/~tns:request:schemaElement:foo2">
           <class ref="com.othernamespace.OhterFoo" />
    </bindings>
</bindings>

我也尝试过以下绑定,但使用此绑定,它甚至不会生成源代码。

<bindings scd="x-schema::tns" xmlns:tns="http:/mynamespace.com/xsd">
        <schemaBindings>
           <package name="com.otherpackage.xsd" />
        </schemaBindings>
        <bindings scd="/type::tns:request/model:sequence/schemaElement::tns:foo">
               <class ref="com.othernamespace.OhterFoo" />
        </bindings>
        <bindings scd="/type::tns:request/model:sequence/schemaElement::tns:foo2">
               <class ref="com.othernamespace.OhterFoo" />
        </bindings>
    </bindings>

【问题讨论】:

  • 当你写&lt;class ref="com.othernamespace.OhterFoo" /&gt;时,它指的是现有的类并且不会生成一个。

标签: xml xsd jaxb scd


【解决方案1】:

使用model::sequence double :: 提供的example

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-02-18
    • 2011-09-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多