I have created the simplest web service in c#:
public void AddData(DataSet ds)
The generated schema (Wsdl) looks like this:
<s:schema xmlns:s="http://www.w3.org/2001/XMLSchema">
...
<s:element ref="s:schema" />
...
</s:schema>
Note the schema does not contain any import/include elements.
I am trying to load this schema to a c# System.Xml.XmlSchema and add it to System.Xml.XmlSchemaSet:
var set = new XmlSchemaSet();
var fs = new FileStream(@"c:\temp\schema.xsd", FileMode.Open);
var s = XmlSchema.Read(fs, null);
set.Add(s);
set.Compile();
The last line throws this exception:
The 'http://www.w3.org/2001/XMLSchema:schema' element is not declared.
It kind of makes sense: The schema generated by .Net uses the "s:schema" type which is declared in a schema which is not imported.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With