Utlimately I want to be able to parse an xml STRING with an xsd STRING but this is the best I could do: parsing an xml FILE with an xsd FILE.

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.

validating xml document using xsd in c net-2validating xml document using xsd in c net-78validating xml document using xsd in c net-41

Label The Xsd; private void Page_Load(object sender, System.

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

Text = ""; //load schema Xml Schema Collection xsc = new Xml Schema Collection(); xsc.

Text, xsc); } private void Validate(String filename, Xml Schema Collection xsc) { Xml Text Reader reader = null; Xml Validating Reader vreader = null; reader = new Xml Text Reader (filename); vreader = new Xml Validating Reader (reader); vreader. Close(); } public void Validation Call Back (object sender, Validation Event Args args) { Outcome.

Validation Event Handler += new Validation Event Handler (Validation Call Back); try { while (vreader. Text = "XML Document is not well-formed."; } vreader.

Asp Alliance Register Edit My Profile Author List Write for Us About Asp Alliance Contact Us Privacy Policy Link To Us Advertise Subscribe Free Newsletter Newsletter Archive RSS Syndication . NET 2.0 Examples ASP Tutorials Learn ASPLearn VBScript Learn JScript Learn SQLLearn XMLSoftware Resources Shopping Cart Ecommerce Charts and Dashboards Other Resources Learn Java Learn Oracle Opinion / Editorial Crystal Reports Alliance WPF Resources AJAX Resources Silverlight Resources Free Tools Cache Manager Simple CMSReviews Book Reviews Product Reviews Expert Advice Books ASP.

NETLearn AJAXLearn Silverlight Learn Visual Studio Learn ADO. NETLearn Web Services Learn Controls Learn Biz Talk Learn Share Point Learn Mobile Learn SQLLearn SQL Reporting Learn Windows Forms Learn XMLLearn Crystal Reports Learn Far Point Learn Dev Express Examples ASP.

Microsoft is conducting an online survey to understand your opinion of the Msdn Web site.

If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.