xml validation using msxml and schema

Discussion in 'XML' started by cyberleo80@libero.it, Jan 3, 2005.

  1. Guest

    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?
     
    , Jan 3, 2005
    #1
    1. Advertising

  2. 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/
     
    Martin Honnen, Jan 3, 2005
    #2
    1. Advertising

  3. Guest

    Martin Honnen wrote:
    > 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
     
    , Jan 4, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Markus
    Replies:
    1
    Views:
    1,672
    Markus
    Nov 23, 2005
  2. linkspeed
    Replies:
    2
    Views:
    726
    Richard Tobin
    Oct 31, 2003
  3. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,332
    Stanimir Stamenkov
    Apr 25, 2005
  4. Udo
    Replies:
    0
    Views:
    378
  5. Replies:
    5
    Views:
    1,114
    Brian McCauley
    Nov 29, 2006
Loading...

Share This Page