> Doc.Loadxml(myxml)
and I have an xsd schema that I want to validate the myxml against. How
can I do this. code would help.
You can use the XmlValidatingReader class to validate against the schema. To
validate the xml fragment in your "myxml" string do this:
NameTable nt = new NameTable();
XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
XmlSchemaCollection xsc = new XmlSchemaCollection();
xsc.Add("urn:myschema", "myschema.xsd");
XmlParserContext context = new XmlParserContext(null, nsmgr, null,
XmlSpace.None);
reader = new XmlValidatingReader(xmlFrag, XmlNodeType.Element, context);
reader.Schemas.Add(xsc);
Anders Norås
http://dotnetjunkies.com/weblog/anoras/