在我的方案中,我的 XSD 应该在一个根标记下有多个组, #XSD#
bootstrap cdn's
当我使用xml验证时,它说这种格式错了, 任何人都可以帮助我知道如何创建多个组
答案 0 :(得分:1)
您错过了复杂类型中的序列
<?xml version="1.0" encoding="utf-8" ?>
<!--Created with Liquid Studio 2017 - Developer Bundle Edition (Trial) 15.0.0.7089 (https://www.liquid-technologies.com)-->
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:group name="location">
<xs:sequence>
<xs:element name="city" type="xs:string" />
<xs:element name="flat_num" type="xs:string" />
<xs:element name="landmark" type="xs:string" />
<xs:element name="street" type="xs:string" />
</xs:sequence>
</xs:group>
<xs:group name="student">
<xs:sequence>
<xs:element name="firstname" type="xs:string" />
<xs:element name="lastname" type="xs:string" />
<xs:element name="mothername" type="xs:string" />
<xs:element name="fathername" type="xs:string" />
</xs:sequence>
</xs:group>
<xs:element name="Student_details" type="details" />
<xs:complexType name="details">
<xs:sequence>
<xs:group ref="location" />
<xs:group ref="student" />
</xs:sequence>
</xs:complexType>
</xs:schema>
我还会质疑一个小组是否最能实现你想要描述的内容。您目前拥有的将生成这样的XML
<?xml version="1.0" encoding="utf-8"?>
<!-- Created with Liquid Studio 2017 - Developer Bundle Edition (Trial) 15.0.0.7089 (https://www.liquid-technologies.com) -->
<Student_details xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="Schema.xsd">
<city>string</city>
<flat_num>string</flat_num>
<landmark>string</landmark>
<street>string</street>
<firstname>string</firstname>
<lastname>string</lastname>
<mothername>string</mothername>
<fathername>string</fathername>
</Student_details>