Lists Home |
Date Index |
> Changing the code to
> var schemas = new ActiveXObject("MSXML2.XMLSchemaCache.4.0");
> schemas.add("http://www.example.org", "cyclic.xsd");
> var x = new ActiveXObject("MSXML2.DOMDocument.4.0");
> x.async = false;
> x.schemas = schemas;
> x.validateOnParse = false; /* don't validate on parse */
> var vError = x.validate(); /* validate, grabbing error object (if any)
Why does this suddenly report the error?
You would think (at least I would) that it wouldn't matter if you validated
the document when it's loaded or if you validate after it's been loaded. Why
is this different and more importantly how will I as a a developer know what
errors are being caught when you validate on load and when you validate
after the document has been loaded?
> /* print error message */
> if(vError.reason != "")
> WScript.Echo("invalid: " + vError.reason);
> Leads to "invalid: Validate failed because the root element had no
> associated DTD/schema" being displayed. Changing the instance to
> <foo xmlns="http://www.example.com"/>
> results in successful validation.