> I assume that the dataset validated the xml string agianst its schema
> - well
> then where does the dataset gets the schema from?
Well the problem is that that assumption is unfortunately wrong. If you wanted to validate the schema you need to put a XmlValidatingReader in the middle of your call to ReadXml. The next problem is, that if you want it to validate specific schemas you need to hook up a custom XmlResolver that helps locate those schemas. The default implementation tries to chase down namespaces URIs, but if the URI isn't a URL (or a URL that it supports natively) then it can't. Therefore you'll probably want to store the schemas in a well known location for your app and have a custom XmlResolver help resolve the schemas from that location.
So you end up with something like so:
<codeSnippet language="C#">
public void MyWebMethod(XmlElement incomingElement)
{
XmlValidatingReader reader = new XmlValidatingReader(new XmlNodeReader(incomingElement));
reader.XmlResolver = new MyCustomXmlResolver();
MyTypedDataSet myDataSet = new MyTypedDataSet();
XmlDataDocument dataDocument = new XmlDataDocument(myDataSet);
dataDocument.Load(reader);
... use dataset ...
}
</codeSnippet>
Now all that's left to do is to write MyCustomXmlResolver. For more details on writing a custom XmlResolver, have a look at this artcile on MSDN[1].
HTH,
Drew
[1] http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cp
conCreatingCustomResolver.asp