O'Reilly logo

Inside XML by Steven Holzner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Validating XML Documents with Internet Explorer

By default, Internet Explorer actually does validate XML documents as it loads them, but you won't see any validation errors unless you check the parseError object.

Turning Validation On and Off

You can turn document validation on or off with the document object's validateOnParse property, which is set to true by default.

Here's an example; in this case, I'll load this XML document, error.xml. This document has a validation problem because the <NAME> element is declared to contain only a <FIRST_NAME> element, not a <LAST_NAME> element:

 <?xml version = "1.0" standalone="yes"?> <!DOCTYPE DOCUMENT [ <!ELEMENT DOCUMENT (CUSTOMER)*> <!ELEMENT CUSTOMER (NAME,DATE,ORDERS)> <!ELEMENT NAME (FIRST_NAME)> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required