Possible Duplicate:
How to create XSD file programmatically in C#?
I have an XDocument object and I want to convert it to a xsd file through code
How am I supposed to do that?
My project looks like this:
WebClient client = new WebClient();
Stream stream = client.OpenRead("http://maps.googleapis.com/maps/api/distancematrix/xml?origins=Vancouver+BC|Seattle&destinations=San+Francisco|Vancouver+BC&mode=bicycling&language=fr-FR&sensor=false");
XDocument doc = XDocument.Load(stream);
Just save it in
XSDextension, if the loadedXMLinXDocumentobject is compliant withXSDformat.ADDED: Or if the
XMLis not inXSDformat then you can generate theXSDbased on the inputXMLusing the below piece of code:Now you can have your
XSDavailable at C:\ drive root.