嗨,谁能给我一个基于此 XSD 文件的简单 XML 示例,可以验证?或解释它到底应该是什么?
我是 XSD 的初学者,不了解整个文档!但我想有一个例子来生成一个基于这个文件的 php 的 XML 可以验证!谢谢,
这是 XSD 文件:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:attribute name="id" type="xs:positiveInteger"/>
<xs:complexType name="station">
<xs:sequence>
<xs:element name="name" type="xs:string" />
</xs:sequence>
<xs:attribute ref="id" use="required"/>
</xs:complexType>
<xs:complexType name="driver">
<xs:sequence>
<xs:element name="name" type="xs:string" />
<xs:element name="birth_date" type="xs:date" />
<xs:element name="email" type="xs:string" />
<xs:element name="phone" type="xs:string" />
<xs:element name="avatar" type="xs:string" />
</xs:sequence>
<xs:attribute ref="id" use="required"/>
</xs:complexType>
<xs:element name="lvb_system">
<xs:complexType>
<xs:sequence>
<xs:element name="line" minOccurs="0" maxOccurs="unbounded" >
<xs:complexType>
<xs:sequence>
<xs:element name="code" type="xs:string" />
<xs:element name="type" type="xs:string" />
<xs:element name="start_time_operation" type="xs:time" />
<xs:element name="end_time_operation" type="xs:time" />
<xs:element name="count_vehicles">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="map" type="xs:string" />
<xs:element name="start_station" type="station" minOccurs="0" maxOccurs="1" />
<xs:element name="end_station" type="station" minOccurs="0" maxOccurs="1" />
<xs:element name="intermediate_stations" type="station" minOccurs="0" maxOccurs="5" />
<xs:element name="vehicles_line" minOccurs="0" maxOccurs="10" >
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" />
<xs:element name="capacity" type="xs:integer" />
<xs:element name="driver" minOccurs="0" maxOccurs="unbounded" type='driver' />
</xs:sequence>
<xs:attribute ref="id" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute ref="id" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>