January 23, 2002 - Parsing Error Pinpointing
![]() |
January 23, 2002 Parsing Error Pinpointing Tips: January 2002
Yehuda Shiran, Ph.D.
|
load() function prints all these attributes for an XML file which includes an error:
function load() {
var xmldoc;
xmldoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
xmldoc.async = false;
xmldoc.load("mydvdwitherror.xml");
if (xmldoc.parseError.errorCode != 0) {
alert("errorCode: " + xmldoc.parseError.errorCode + "\n" +
"filepos: " + xmldoc.parseError.filepos + "\n" +
"line: " + xmldoc.parseError.line + "\n" +
"linepos: " + xmldoc.parseError.linepos + "\n" +
"reason: " + xmldoc.parseError.reason + "\n" +
"srcText: " + xmldoc.parseError.srcText + "\n" +
"url: " + xmldoc.parseError.url);
} else {
alert(xmldoc.documentElement.xml);
}
}
We took a valid XML file and modified the </DATA> field to <DATA>. We put the XML file in mydvdwitherror.xml. Try loading this file. You should get an alert box with all the error information described above.


Find a programming school near you