.net - xsd validation againts xsd generated class level validation -


I have a large XSD file in my project that I can use to validate the response to an XML request and a third party I use

For the above scenario, I can have 2 approaches

1) Create XML and then validate against giving XSD 2) Create a class with XSD normal tool from XSD, Attribute Add extras and use them for verification.

Verification in another way will work somewhat in this way, a) Change XML Request / Response in Object with XML Serialization. B) Validate the object with custom attributes set on each property, That is, pass an object to a method that will validate the object again by the properties set on each property and its custom attributes, and it is a bol Valued value will return if the object is valid and that it determines the XML request is valid or not?

Now the attitude of anxiety is good in terms of performance and anything else ???

If your primary concern is functionality , then you should check it for XSD schema verification An attached here is an example:

  // to reuse the compiled XSD schema // a reference of this object // XmlReaderSettings settings = new XmlReaderSettings () for multiple parsing operations; Settings. Chimes Add ("http://www.contoso.com/books", "books.xsd"); Settings.ValidationType = Validation Type Sema; (XmlReader Reader = XmlReader.Create ("books.xml", setting)) {while (reader.Read ()) {// Do parseing logic}}  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -