"TP-Software" <tp********@users.sourceforgE.net> wrote in message
news:3f***********************@reader0.news.skynet .be...
Hi,
What's the fastest way to validate an XML document against an XML Schema?
All I need to know is wether or not the document is valid in respect to
the Schema
XmlTextReader reader = new XmlTextReader(fileName);
XmlValidatingReader vReader = new XmlValidatingReader(reader);
vReader.ValidationType = ValidationType.Schema;
try
{
while(vReader.Read());
}
catch
{
// error
}
If the schema is not in the XML file, you can use:
vReader.Schemas.Add(...) to add a reference to the schema.
---
Steven Wood