XML validation: Difference between revisions

Content deleted Content added
Created page with "{{draft task}} Given an XML document and an XSD schema definition validate that the document follows the schema described. =={{header|C sharp}}== <lang csharp> using System..."
 
Line 16:
// your code goes here
XmlSchemaSet sc = new XmlSchemaSet();
sc.Add(null, "http://wwwvenus.publiceas.asu.edu/~jtrujil1WSRepository/xml/HotelCourses.xsd");
XmlReaderSettings settings = new XmlReaderSettings();
settings.ValidationType = ValidationType.Schema;
Line 22:
settings.ValidationEventHandler += new ValidationEventHandler(ValidationCallBack);
// Create the XmlReader object.
XmlReader reader = XmlReader.Create("http://wwwvenus.publiceas.asu.edu/~jtrujil1WSRepository/xml/HotelCourses.xml", settings);
// Parse the file.
while (reader.Read());