尝试让 xsd 匹配两个文档时遇到了一些麻烦:
XML 文档 1:
<?xml version="1.0" encoding="UTF-8"?>
<video contenttype="asf" fileextension=".wmv" hascontent="no" lang="en-GB" length="1800" pid="3678738364972" sid="">
<lastmodified timestamp="1282678200000">
Tue, 24 Aug 2010 19:30:00 +0000
</lastmodified>
<links/>
<keywords/>
<slides/>
<copyright>
Copyright owned by original broadcaster
</copyright>
<title>
Friends
</title>
<comment>
The One Where the Monkey Gets Away: Rachel accidentally lets Ross's pet monkey escape, then learns that her former best friend is engaged to marry her ex-fiancé. [AD,S]
</comment>
<author>
E4
</author>
<email/>
<captioning/>
<extendeddata>
<data name="keepOriginal">
0
</data>
<data name="keepTranscoded">
0
</data>
<data name="realStartTime">
1282677909
</data>
<data name="scheduledStartTime">
1282678200
</data>
<data name="broadcastLength">
1800
</data>
<data name="broadcastChannel">
E4
</data>
<data name="paddingUsed">
300000
</data>
<data name="transcodingSpec">
-b 2.35M -a 128k --debug --primary-format mp4 --podcast "-l 270 -b 600 -R 48 -B 64" --keep-files true
</data>
<data name="transcoding">
succeeded
</data>
<data name="transcodingProfile">
-b 2.35M -a 128k --debug --primary-format mp4 --podcast "-l 270 -b 600 -R 48 -B 64" --keep-files true
</data>
<data name="transcoderDetails">
ver 1.58.2.1, 2010-08-24 21:31:33 up 5 days, 11:24, 0 users, load average: 3.08, 3.38, 2.67, OS20031 212.70.69.26
</data>
<data name="originalFilename">
/var/lib/etvd/mpegts/E4/Friends (24-Aug-2010 20.30).emcast
</data>
<data name="originalRecordingTime">
created 2010-08-24 , last modified 2010-08-24 : recording lasted 0s
</data>
<data name="primaryFormat">
mp4
</data>
<data name="doXml">
True
</data>
<data name="doFiles">
True
</data>
</extendeddata>
<categories>
<category name="em:podcast">
mp4
</category>
</categories>
</video>
XML 文档 2:
<?xml version="1.0" encoding="UTF-8"?>
<video xmlns="UploadXSD">
<title>
A vid with Pete
</title>
<description>
Petes vid
</description>
<contributor>
Pete
</contributor>
<subject>
Cat 2
</subject>
</video>
提议的 XSD:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="UploadXSD"
targetNamespace="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>
是否可以使用 c# 来验证两个 xml 文档而不使用命名空间?因为使用 XML 文档 1(上)它是由第三方系统创建的,它不能生成命名空间......
最近几天问了一些关于xml的问题,感谢帮助我对此很陌生...