Xmlvalidatingreader xsd


26-Mar-2015 09:59

static string Error Message = ""; public static void Validation Handler(object sender, Validation Event Args args) { Error Message = Error Message + args.

I basically reworked a console application example in the MSDN help file into a nicer looking ASP. It tells you if your file is not well-formed and then if it is not valid it lists out the specific reason (like in XMLSpy), quite helpful to find an error in a large XML file as it returns the line number on which the error occurred as well as the tag name. NET so to get it to work you will have to change the code around to whatever you want to do.

Notice that you have to have the namespace in the root element of the XML file.

Text = ""; } private void Button1_Click(object sender, System.

Xml; namespace Xml Reader Settings Class { public partial class Form1 : Form { public Form1() { Initialize Component(); } private void Form1_Load(object sender, Event Args e) { string str Xml Path = " Shop.xml"; string str Xml XSDPath = " Shop.xsd"; //把这个Book Shop.xml文件打开成流 File Stream stream = new File Stream(str Xml Path, File Mode. Add(null, str Xml XSDPath); //说明验证的方式是根据XML架构来验证 xvr. Validation Event Handler += new Validation Event Handler(Validation Handler); //对文档进行验证 while (xvr.