Results 1 to 8 of 8

Thread: Validating an XML document with an XSD

Hybrid View

  1. #1

    Thread Starter
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Validating an XML document with an XSD

    I'm new to XML.

    I have created an XML document that references an XSD doucment. How do I validate the XML document according to the rules defined in the XSD? I simply want to know if it complies...
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    You'll most likely need to do it through code. What language are you programming in?

    If you just want to check if the document is valid against a schema, you can use this online validator:

    http://apps.gotdotnet.com/xmltools/xsdvalidator/

    (ASP.NET/VB.NET CodeBehind)

  3. #3

    Thread Starter
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796
    VB6 ideally...
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Hmm... I don't know how to do this in VB6, only in VB.NET.

    But see if this link helps, it's got code later.

    http://www.developerfusion.com/show/2386/

  5. #5

  6. #6

    Thread Starter
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796
    Martin Liss
    I have tried the code that you posted in your linked thread but I still have a problem.


    When I run the following line of code:
    VB Code:
    1. oxmlSchema.Add "", strSchemaFile
    I get the following error:
    Code:
    Incorrect definition for the root element in schema.
    I know my schema is valid because it validates here.

    There is one difference I should mention, I had to define my schema object as: MSXML2.XMLSchemaCache30
    This is because I get the following run time error when I attempt to instantiate an object of type: MSXML2.XMLSchemaCache40:
    Code:
    Unable to create ActiveX object
    Any thoughts?
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

  7. #7

  8. #8

    Thread Starter
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796
    Martin Liss

    Thanks for your advice. I have downloaded MSXML4 (SP2).

    Now it works fine!
    Last edited by simonm; Sep 13th, 2004 at 10:22 AM.
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width