日期:2014-05-18 浏览次数:20883 次
using System; using System.Xml; using System.Xml.Schema; using System.IO; public class Sample { public static void Main() { // Set the validation settings. XmlReaderSettings settings = new XmlReaderSettings(); settings.ProhibitDtd = false; settings.ValidationType = ValidationType.DTD; settings.ValidationEventHandler += new ValidationEventHandler (ValidationCallBack); // Create the XmlReader object. XmlReader reader = XmlReader.Create("itemDTD.xml", settings); // Parse the file. while (reader.Read()); } // Display any validation errors. private static void ValidationCallBack(object sender, ValidationEventArgs e) { Console.WriteLine("Validation Error: {0}", e.Message); } }
------解决方案--------------------
强烈建立楼主下一个xml schema看看,
下下来看看清楚明白了,,再不懂得就发帖问问就可以了。。。。
http://www.jb51.net/books/11609.html