Validating xml schema net
Try this (untested): // Load document XDocument doc = XDocument.Load("file.xml"); // Extract value of xsi:no Namespace Schema Location XNamespace xsi = " string schema URI = (string)doc. Attribute(xsi "no Namespace Schema Location"); // Create schema set Xml Schema Set schemas = new Xml Schema Set(); schemas. // Source code of web service [Web Method] public Data Set Add Event() After that, I used wiht Windows Application and it show error. Argument Exception: Keyword not supported: '"data source'.
You can also pass an empty string like I did in the example.
Sql Connection String..ctor(String connection String) at System. I also want to stay away from hardcoding schemas into the code. The method you are referreing to, first ensures that the xml is not null, then it writes the xml document to a stringreader and calls the Valid Xml Doc method that does the actual work public bool Valid Xml Doc(String Reader xml, string schema Namespace, string schema Uri).
How can I make sure that all relevant schemas are made available to the validator, while still only providing the xml document as an argument. Look at your code for the check method as shown below: You check the xml document for null and after that it is never used in this method again. The Valid Xml Doc method has several overloaded methods.
Parse Internal(Hashtable parsetable, String connection String, Boolean build Chain, Hashtable synonyms, Boolean first Key) at System.
Db Connection Options..ctor(String connection String, Hashtable synonyms, Boolean use Odbc Rules) at System. If you notice at the end of the method your are looking at, the last line before the catch statement is: return Valid Xml Doc(sr Xml, schema Namespace, schema Uri); For further help, if you run the downloadable solution, you can put a break point in the method of concern, and step through the code.
Why do you get the value of the xmlns attribute and concatenate it with the value of the xsi:no Namespace Schema Location attribute?