xsd validation againts xsd generated class level validation
Posted
by Miral
on Stack Overflow
See other posts from Stack Overflow
or by Miral
Published on 2009-04-28T10:46:50Z
Indexed on
2010/04/05
19:03 UTC
Read the original article
Hit count: 1075
In my project I have very big XSD file which i use to validate some XML request and response to a 3rd party.
For the above scenario I can have 2 approaches
1) Create XML and then validate against give XSD 2) Create classes from XSD with the help of XSD gen tool, add xtra bit of attirbutes and use them for validation.
Validation in the second way will work somewhat in this manner, a) convert xml request/response into object with XML Serialization b) validate the object with custom attributes set on each property, i.e. Pass the object to a method which will validate the object by iterating through properties and its custom attributes set on the each property, and this will return a boolean value if the object validates and that determines whether the xml request is valid or not?
Now the concern which approach is good in terms of performance and anything else???
© Stack Overflow or respective owner