www.webdeveloper.com
Results 1 to 2 of 2

Thread: Question of XSD

  1. #1
    Join Date
    Sep 2004
    Location
    At the corner of WALK and DONT WALK
    Posts
    1,704

    Question of XSD

    If you use an XSD instead of a DTD/Doctype, is it still possible to validate XML?

  2. #2
    Join Date
    May 2008
    Posts
    381
    Yes, it is. However, if you use the W3C services to do validation (as opposed to something like Stylus Studio or even a programming/scripting language like Python), you can't use the W3C Markup Validator. You need to use the XML Schema Validator.

    XSV, as it is more commonly known, admittedly can seem rather complex at first. For example, if you want to validate an XML document completely against a W3C XML schema instance referenced by said XML document, you would need to make sure the schema instance is available to XSV as well as using the XML document. Of course, if you just want to check a schema document, you could simply use it as the input and check the box next to "Check as complete schema" to treat the input as a schema automatically. There is also the issue of the output format (four different ways, all of which have their place). Lastly, I used to notice caching issues in some cases, so a hard refresh when validating the same document multiple times might be necessary.

    There is a similar service that is a bit simpler at http://tools.decisionsoft.com/schemaValidate/; it allows you to use a single XML document AND a single schema instance, a slight improvement compared to XSV, which allows only the XML document or only the schema instance to be validated by upload. On the other hand, it is slightly deficient compared to XSV in the way it works since it requires the files to be uploaded, not to mention you can use multiple schema instances.

    There are other services available, but generally using a programming language or a library/module for that language with XML and XSD validation capabilities works better. PHP 5 with the DOM extension appears to be simple enough to use, and I'm sure there are other possibilities for PHP 4/5 as well as other languages, though PHP 4's DOM XML extension has no facility to do this (upgrade to PHP 5 or maybe a library exists?)

    The simple answer: yes, it is possible to validate XML documents against schemas instead of a DTD.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles