我如何将这种简单类型的 xsd 转换为复杂类型的 XSD [英] How do i convert this simple type xsd to a complex type XSD
问题描述
`我有一个简单类型的 xsd 元素,我想将其转换为复杂类型,因为我希望最终的 wsdl 是文档类型文字格式.你们能帮忙吗?
`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
推荐答案
这是一种方法.问题是,您一次只能扩展/限制一个,因此采用两步法.
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>
这篇关于我如何将这种简单类型的 xsd 转换为复杂类型的 XSD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!