如何创建这些XSD的所有可能的XML:
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns="http://beep2000/client/beep.de" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://beep2000/client/beep.de">
<xsd:complexType name="TextType">
<xsd:sequence>
<xsd:element name="Text" minOccurs=1">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="255"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="StreetType">
<xsd:sequence>
<xsd:element name="Street" type="xsd:string" minOccurs="1"/>
<xsd:element name="HouseNumber" type="xsd:int" minOccurs="1"/>
<xsd:element name="Suffix" type="xsd:string" minOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="1"/>
<xsd:enumeration value="A"/>
<xsd:enumeration value="B"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="BodyType">
<xsd:sequence>
<xsd:element name="FirstPart" type="TextType" minOccurs="1"/>
<xsd:element name="SecondPart" type="TextType" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="AdressType">
<xsd:sequence>
<xsd:element name="Street" type="StreetType" minOccurs="0">
<xsd:element name="PostalCode" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="5"/>
<xsd:pattern value="[0-9]{5}"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="City" type="xsd:string" minOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="RequestEnvelope">
<xsd:sequence>
<xsd:element name="Title" type="xsd:string" minOccurs="0"/>
<xsd:element name="Forename" type="xsd:string" minOccurs="1"/>
<xsd:element name="Surname" type="xsd:string" minOccurs="0"/>
<xsd:element name="PersonalID" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="20"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Adress" type="AdressType" minOccurs="0"/>
<xsd:element name="Body" type="BodyType" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ResponseEnvelope">
<xsd:sequence>
<xsd:element name="Result" minOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="3"/>
<xsd:enumeration value="OK"/>
<xsd:enumeration value="NOK"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Errorcode" type="xsd:integer" minOccurs="0"/>
<xsd:element name="Errortext" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="255"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Comment" type="TextType" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="MsgResponse" type="ResponseEnvelope"/>
<xsd:element name="MsgRequest" type="RequestEnvelope"/>
</xsd:schema>
有些字段是可选的,某些字段是必填字段。所以有各种各样的XML。如何找到所有可能的XML结构?
我期待的是:
XML No.1:
XML No.2。:
答案 0 :(得分:0)
生成符合此模式的所有可能的XML文件将花费无限的时间,并且它们将占用无限的空间。
但是,您可以使用如下所述的工具生成一系列示例文档: