This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Microsoft XML > March 2006 > XmlSchemaValidator and XmlSerializer.Deserialize() method
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
XmlSchemaValidator and XmlSerializer.Deserialize() method
|
|
|
| In an application which uses an XML file, I wish to use XmlSchemaValidator
class to validate this file against the XSD file..
In the example of msdn, (
http://msdn2.microsoft.com/en-us/li...schemavalidator(VS.80).aspx )
, before initialising the XmlSchemaValidator, XmlSerializer is initialised.
I saw that if there is a node or attribute which is not valid (to xml
schema), the method XmlSerializer.Deserialize() launches an exception. It
means that before validating this file ( or stream ) its already controlled
by Deserialize method.
I wish to know what is the need to Validate this file against
XmlSchemValidator, if its already controlled ? Will it be efficient, if I
skip this Validation ? If not, why ?
Thanks in advance for the comments
Vivek
| |
| Zafar Abbas 2006-03-29, 6:49 pm |
| XmlSchemaValidator is a push model validator. You dont have to use it if you
already have an XML and a XSD schema file. You could use XmlReader created
via the static XmlReader.Create overloads to validate your file.
http://msdn2.microsoft.com/en-us/library/x1h1125x(VS.80).aspx
"Vivek" <viveknospamsheel@msn.com> wrote in message
news:e%23WJa3mUGHA.1728@TK2MSFTNGP11.phx.gbl...
> In an application which uses an XML file, I wish to use XmlSchemaValidator
> class to validate this file against the XSD file..
>
> In the example of msdn, (
>
http://msdn2.microsoft.com/en-us/li...schemavalidator(VS.80).aspx )
> , before initialising the XmlSchemaValidator, XmlSerializer is
initialised.
>
> I saw that if there is a node or attribute which is not valid (to xml
> schema), the method XmlSerializer.Deserialize() launches an exception. It
> means that before validating this file ( or stream ) its already
controlled
> by Deserialize method.
>
> I wish to know what is the need to Validate this file against
> XmlSchemValidator, if its already controlled ? Will it be efficient, if I
> skip this Validation ? If not, why ?
>
> Thanks in advance for the comments
>
> Vivek
>
>
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|