Spyne - 如何为xml_choice_group设置min_occurs或max_occurs属性?

时间:2015-02-09 16:32:24

标签: spyne

我正在尝试实施第三方服务(从WSDL自动生成服务获得+1票!)并且我试图声明具有强制匿名选择的类型。从外部XSD我有:

<xsd:complexType name="PriceType">
    <xsd:sequence>
        <xsd:element maxOccurs="1" minOccurs="1" name="totalAmount" type="xsd:decimal">
        </xsd:element>
        <xsd:choice maxOccurs="1" minOccurs="1">
            <xsd:element maxOccurs="1" minOccurs="0"
                         name="currencyCode" type="CurrencyCodeType">
            </xsd:element>
            <xsd:element maxOccurs="1" minOccurs="0"
                         name="currencynit" type="CurrencyUnitType">
            </xsd:element>
        </xsd:choice>
    </xsd:sequence>
</xsd:complexType>

我拥有的是

class PriceType(ComplexModel):
    totalAmount = Decimal(min_occurs=1)
    currencyCode = CurrencyType(xml_choice_group="price_unit_choice")
    unit = CodeNameType(xml_choice_group="price_unit_choice")

但我不确定如何指定&#34; price_unit_choice&#34;的强制性质。组。我无法找到如何在Spyne文档和测试文件中设置choice元素的min_occurs / max_occurs。有人有他们可以分享的例子吗?

0 个答案:

没有答案