![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: xml validation using msxml and schema [Thread Next] Re: xml validation using msxml and schemaTo: NULL Date: 1/4/2005 1:38:00 AM Martin Honnen wrote:
> cyberleo80@l... wrote:
>
>
> > i tring to validate an xml doc at runtime with this code:
> >
> > set objXMLSchema = Server.CreateObject ("Msxml2.DOMDocument.4.0")
> > objXMLSchema.async = false
> > objXMLSchema.validateOnParse = true
> > objXMLSchema.load Server.MapPath(".") & "schemas\Schema.xsd"
> >
> > set objXMLSchemaCache =
> > Server.CreateObject("Msxml2.XMLSchemaCache.4.0")
> > objXMLSchemaCache.add "", objXMLSchema
> >
> > objXMLDocument.async = false
> > objXMLDocument.validateOnParse = true
> >
> > set objXMLDocument.schemas = objXMLSchemaCache
> >
> > objXMLDocument.load( Request )
>
> Check the return value of the load method e.g.
> Dim Valid
> Valid = objXMLDocument.load(Request)
> If Valid Then
> ...
> Else
> check objXMLDocument.parseError.reason
>
>
> --
>
> Martin Honnen
> http://JavaScript.FAQTs.com/
thanks...
your hint is valid...
but the correct code is:
set objXMLDocument = Server.CreateObject ("Msxml2.DOMDocument.4.0") '
lista in arrivo
objXMLDocument.async = false
objXMLDocument.validateOnParse = true
set objXMLSchemaCache = Server.CreateObject
("Msxml2.XMLSchemaCache.4.0") ' cache
objXMLSchemaCache.add "", Server.MapPath(".") & "\schemas\Schema.xsd"
set objXMLDocument.schemas = objXMLSchemaCache
Dim valid
valid = objXMLDocument.load(Request)
if( not valid ) then
'insert error management here
end if
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
