Hi Jackie,
Has .NET any XML-based validation framework or tool classes to validate
parameters passed to an Web Service?
I need only couple of types validation
- is parameter passed to Web Service method empty
- does parameter belong to certain value set which is mentioned
earlier somewhere in XML files.
Unfortunately, the Framework won't make these types of checks for you. It
can throw an exception if a parameter is of wrong type (for example, a
string instead of an integer), but other than that, you would need to check
the parameters yourself.
Checking for an empty string for example is very simple, but matching
against a list of values required some more lines of code. The exact code
would of course depend on your XML file format, etc. One way to read your
XML files would be to use the XmlTextReader class. This is a good solution
of your XML files are very simple.
Hope this helps.
--
Regards,
Mr. Jani Järvinen
C# MVP
Helsinki, Finland
ja***@removethis.dystopia.fi http://www.saunalahti.fi/janij/