XmlReaderSettings
In this chapter you will learn:
Set up XmlReaderSettings
using System;/* j a va 2 s.co m*/
using System.Collections.Generic;
using System.Data;
using System.Xml;
using System.Xml.Schema;
public class MainClass
{
public static void Main()
{
XmlReaderSettings settings = new XmlReaderSettings();
settings.ProhibitDtd = false;
settings.ValidationType = ValidationType.DTD;
//settings.ValidationType=ValidationType.Schema;
//settings.Schemas.Add("", "");
settings.ValidationEventHandler += new ValidationEventHandler(OnValidationError);
XmlReader reader=XmlReader.Create("value", settings);
while (reader.Read())
{
}
reader.Close();
}
static void OnValidationError(object sender, ValidationEventArgs e)
{
MessageBox.Show(e.Message);
}
}
Next chapter...
What you will learn in the next chapter: