I have no idea, since we don't know what your DTD or Schema look like, are you sure the path for your schema file is correct and the file is properly saved?can you write a console application similar to what is in http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemxmlxmlvalidatingreaderclassschemastopic.aspand make sure your xml file is valid?
change your xml to (if the files are not in the same directory, modify DTD's path):<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE ContactMenList SYSTEM "01.DTD"> <ContactMenList> .... also see http://expert.csdn.net/Expert/topic/2566/2566308.xml?temp=.7952997
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemxmlxmlvalidatingreaderclassschemastopic.aspand make sure your xml file is valid?
这是一个意外的标记。标记应为“DOCTYPE”。 行 1,位置 3。ValidationType设为DTD和Auto都不行,请各位高手再帮帮分析......01.DTD如下
###############<!ELEMENT ContactMenList (ContactMen)*>
<!ELEMENT ContactMen (Name, ID, Company, Email, Phone, Address)>
<!ELEMENT Address (Street, City, Province)>
<!ELEMENT Name (#PCDATA)>
<!ELEMENT ID (#PCDATA)>
<!ELEMENT Company (#PCDATA)>
<!ELEMENT Email (#PCDATA)>
<!ELEMENT Phone (#PCDATA)>
<!ELEMENT Street (#PCDATA)>
<!ELEMENT City (#PCDATA)>
<!ELEMENT Province (#PCDATA)>
<!ATTLIST Company Type (Big | Middle | Small) "Big">01.xml如下
##################
<?xml version="1.0" encoding="utf-8"?>
<ContactMenList>
<ContactMen>
<Name>Miss Li</Name>
<ID>002</ID>
<Company Type="Big">LIS com..</Company>
<Email>[email protected]</Email>
<Phone>(021)87654321</Phone>
<Address>
<Street>French Piry Ahool area no.66</Street>
<City>Piry</City>
<Province>Piry</Province>
</Address>
</ContactMen>
<ContactMen>
<Name>Miss. Huang</Name>
<ID>003</ID>
<Company Type="Big">New gig Company</Company>
<Email>[email protected]</Email>
<Phone>(010)89945678</Phone>
<Address>
<Street>Five street no. 11</Street>
<City>Beijing</City>
<Province>Beijing</Province>
</Address>
</ContactMen>
</ContactMenList>
xdr和xsd不能用XmlSchema类加入,要直接加入XmlSchemaCollection,并让名字空间为空...
<!DOCTYPE ContactMenList SYSTEM "01.DTD">
<ContactMenList>
....
also see
http://expert.csdn.net/Expert/topic/2566/2566308.xml?temp=.7952997