How do i convert this simple type xsd to a complex type XSD

江枫思渺然 提交于 2019-12-25 02:40:54

问题


`I have a simple type xsd element which i want to convert to a complex type because i want the final wsdl to be document type literal format. Could you guys help?

<xsd:element name="Service">
    <xsd:simpleType>
      <xsd:restriction base="xsd:string">
        <xsd:enumeration value="loan.CreateLead" />
      </xsd:restriction>
    </xsd:simpleType>
  </xsd:element>

I want this to be converted to a complex type with the same name element and having an enumeration value. Please let me know on this? Thanks Buyan


回答1:


This is one way of doing it. The thing is, you can only extend/restrict one at a time, hence the two-steps approach.

I kept the original one unchanged for reference only, otherwise the first Service element could've been of "arestriction" type.

<?xml version="1.0" encoding="utf-8" ?>
<!-- XML Schema generated by QTAssistant/XSD Module (http://www.paschidev.com) -->
<xsd:schema targetNamespace="http://tempuri.org/XMLSchema.xsd" xmlns="http://tempuri.org/XMLSchema.xsd" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="Service">
        <xsd:simpleType>
            <xsd:restriction base="xsd:string">
                <xsd:enumeration value="loan.CreateLead"/>
            </xsd:restriction>
        </xsd:simpleType>
    </xsd:element>

    <xsd:simpleType name="arestriction">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="loan.CreateLead"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:element name="Service1">
        <xsd:complexType>
            <xsd:simpleContent>
                <xsd:extension base="arestriction"/>
            </xsd:simpleContent>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>


来源:https://stackoverflow.com/questions/19549745/how-do-i-convert-this-simple-type-xsd-to-a-complex-type-xsd

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!