Results 1 to 2 of 2

Thread: Validating some XML against a DTM / Schema?

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2001
    Location
    Melbourne, Australia
    Posts
    45

    Question Validating some XML against a DTM / Schema?

    Hello All.

    I have a program that accepts some XML.

    Now, this program can accept ANY STRING, which is bad.

    I wish to check the input string by loading it into an XML Dom, and seeing if it's parsed ok. [This i can do].

    If it's parsed ok, i need to check to see if the XML content conforms to my XML Schema / DTD (so i know they have passed well parsed, and well comformed XML).


    How do i check if the well parsed XML is WELL COMFORMED?

    How do i check the XML against an XML Schema / Dtd?


    Thank you for any help, and Merry X-Mas

    -Pure Krome-

  2. #2
    Member
    Join Date
    Feb 2000
    Location
    Kettering, Northants, England
    Posts
    56
    Using MS XML Parser v4.0, You can instantiate a DOMDocument40 object and the document's parseError property will expose well-formedness against any internal DTDs. If you use External DTDs then you must use the resolveExternal method. In the case of Schemas, you can instantiate a SchemaCache40 object and valdate against it.

    For more info see:

    msdn online

    Cheers,

    DJ

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