Bostonasian wrote:
I need to write a method that takes System.Xml.XmlD ocument and Xsd Path
to validate XmlDocument.
How can I convert XmlDocument to XmlReader?
[.NET 1.X]
Efficient way is to use XmlNodeReader, but that won't help with
validation. For validation you need XmlTextReader, so usual way of doing
it (not really efficient, but working one) is
XmlTextReader r = new XmlTextReader(n ew StringReader(xm lDoc.OuterXml)) ;
XmlvalidatingRe ader vr = new XmlValidatingRe ader(r);
....
[.NET 2.0]
In .NET 2.0 XmlDocument has Validate() method.
--
Oleg Tkachenko [XML MVP, MCAD]
http://www.xmllab.net http://blog.tkachenko.com