Hello,
I have an XML and XSD file. When I do validation in the XML file I only get the first error. Is
it possible to list all errors?
One other question.
-------------Microsoft Sample Code -------------------
XmlReaderSettin gs settings = new XmlReaderSettin gs();
settings.Schema s.Add("http://www.contoso.com/books", "contosoBooks.x sd");
settings.Valida tionType = ValidationType. Schema;
XmlReader reader = XmlReader.Creat e("contosoBooks .xml", settings);
XmlDocument document = new XmlDocument();
document.Load(r eader);
ValidationEvent Handler eventHandler = new ValidationEvent Handler(Validat ionEventHandler );
document.Valida te(eventHandler );
-----------------http://msdn.microsoft. com/en-us/library/ms162371.aspx ---------------
What is the point of first creating a XmlReader and passing in the XmlReaderSettin gs ?
Wouldn't it be easier to just use something like this:
----------------------------------------------
XmlDocument document = new XmlDocument();
document.Load(F ilename)
XmlReaderSettin gs settings = new XmlReaderSettin gs();
settings.Valida tionType = ValidationType. Schema;
document.Schema s.Add(settings. Schemas.Add(nul l, "contosoBooks.x ml"));
ValidationEvent Handler eventHandler = new ValidationEvent Handler(Validat ionEventHandler );
document.Valida te(eventHandler );
----------------------------------------------
Am I missing something? What is the point of loading in the reader first.
Thank you for taking the time to read this.
--
Adhal Freeware
There are only 10 types of people in the world: Those who understand binary, and those who don't.
I have an XML and XSD file. When I do validation in the XML file I only get the first error. Is
it possible to list all errors?
One other question.
-------------Microsoft Sample Code -------------------
XmlReaderSettin gs settings = new XmlReaderSettin gs();
settings.Schema s.Add("http://www.contoso.com/books", "contosoBooks.x sd");
settings.Valida tionType = ValidationType. Schema;
XmlReader reader = XmlReader.Creat e("contosoBooks .xml", settings);
XmlDocument document = new XmlDocument();
document.Load(r eader);
ValidationEvent Handler eventHandler = new ValidationEvent Handler(Validat ionEventHandler );
document.Valida te(eventHandler );
-----------------http://msdn.microsoft. com/en-us/library/ms162371.aspx ---------------
What is the point of first creating a XmlReader and passing in the XmlReaderSettin gs ?
Wouldn't it be easier to just use something like this:
----------------------------------------------
XmlDocument document = new XmlDocument();
document.Load(F ilename)
XmlReaderSettin gs settings = new XmlReaderSettin gs();
settings.Valida tionType = ValidationType. Schema;
document.Schema s.Add(settings. Schemas.Add(nul l, "contosoBooks.x ml"));
ValidationEvent Handler eventHandler = new ValidationEvent Handler(Validat ionEventHandler );
document.Valida te(eventHandler );
----------------------------------------------
Am I missing something? What is the point of loading in the reader first.
Thank you for taking the time to read this.
--
Adhal Freeware
There are only 10 types of people in the world: Those who understand binary, and those who don't.
Comment