all groups > dotnet xml > december 2004 >
You're in the

dotnet xml

group:

validate against xsd


validate against xsd CK
12/28/2004 1:31:25 AM
dotnet xml:
I am doing a

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.


Thanks in advance.

Re: validate against xsd Mujtaba Syed
12/28/2004 10:39:00 AM
You can either inline your schema or reference it in your XML document and
then use the XmlValidatingReader to validate as follows:

XmlDocument doc = new XmlDocument();
XmlTextReader tr = new XmlTextReader("data.xml");
XmlValidatingReader reader = new XmlValidatingReader(tr);
doc.Load(reader);

Thanks,
Mujtaba.

[quoted text, click to view]

AddThis Social Bookmark Button