opening and validating XMLfile in one go ??

  • Thread starter Thread starter cmrchs
  • Start date Start date
C

cmrchs

Hi,

when opening an Xml-file to I want to perform validation immediately but the following does not work :

DataSet m_dsProducts = new DataSet();
m_dsProducts.ReadXmlSchema("cu.xsd");
m_dsProducts.ReadXml("cu.xml", XmlReadMode.ReadSchema);

The file opens but no runtime error when i pass an non-valid xml-file.

How come ?
Thnx
Chris


**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 
The file opens but no runtime error when i pass an non-valid xml-file.

Instead of passing in the XML file name, bind an instance of
XmlValidatingReader to the XML file, and pass that to
m_dsProducts.ReadXml().
 
Back
Top