Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > xml validation using msxml and schema

Reply
Thread Tools

xml validation using msxml and schema

 
 
cyberleo80@libero.it
Guest
Posts: n/a
 
      01-03-2005
hi...
as in object...
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 )

set myerr = objXMLDocument.validate()
but the validity is not verified....
can somebody help me?

 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      01-03-2005


http://www.velocityreviews.com/forums/(E-Mail Removed) 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/
 
Reply With Quote
 
 
 
 
cyberleo80@libero.it
Guest
Posts: n/a
 
      01-04-2005
Martin Honnen wrote:
> (E-Mail Removed) 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
web.xml / XML schema issue, why do some XML schema attributes disappear asciz@starmail.com Java 3 02-20-2007 09:56 AM
Validation with XSD using XML::LibXML::Schema, and XML::Validator::Schema huntingseasonson@gmail.com Perl Misc 5 11-29-2006 12:37 PM
MSXML and Schema: Using for XML-Node creation Udo XML 0 08-12-2006 09:12 PM
[XML Schema] Including a schema document with absent target namespace to a schema with specified target namespace Stanimir Stamenkov XML 3 04-25-2005 09:59 AM
MSXML schema validation on type "token" linkspeed XML 2 10-31-2003 05:57 PM



Advertisments