我有xml:
<video contenttype="asf" fileextension=".wmv" hascontent="no" lang="en-GB" length="1800" pid="3678738364972" sid="">
<title>A vid with Pete</title>
<description>Petes vid</description>
<contributor>Pete</contributor>
<subject>Cat 2</subject>
</video>
我想使用 xsd 模式验证视频元素是否存在,但我真的不在乎它有什么属性(实际上我想忽略这些属性)。我只关心存在的视频元素。可以用 xsd 做到这一点吗?
目前xsd是:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="UploadXSD"
elementFormDefault="qualified"
xmlns="http://tempuri.org/UploadXSD.xsd"
xmlns:mstns="http://tempuri.org/UploadXSD.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="video">
<xs:complexType>
<xs:sequence>
<xs:element name="title" minOccurs="1" type="xs:string"></xs:element>
<xs:element name="description" type="xs:string"></xs:element>
<xs:element name="contributor" type="xs:string"></xs:element>
<xs:element name="subject" type="xs:string"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>