2

私は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>
4

1 に答える 1

2

はい、シーケンスの後に要素で指定するだけです: here's xs:anyAttributea link .complexType

于 2010-11-30T17:55:21.350 に答える