Compability: Internet Explorer
This property contains the position of the character within the line where the parse error occurs.
XML:
<staff>
<employee
ssn="123456"
pay="3">
<name>John Sullivan</name>
<position>senior executive</position>
</employee>
<employee
ssn="987654"
pay="2">
<name>Mary Lopez<name>
<position>personal assistant</position>
</employee>
</staff>
JavaScript:
xml_doc = new ActiveXObject("Microsoft.XMLDOM");
xml_doc.async = false;
xml_doc.load("staff.xml");
err = xml_doc.parseError;
if (err.errorCode != 0)
alert("Line: " + err.line + "\nLine Position: " + err.linepos);Line: 10
Line Position: 25In this example the file 'staff.xml' is loaded which includes an error: the slash character (/) is missing from the closing 'name' tag of the second 'employee' element. If a parse error occurs, as it does in this case, an alert displays the number of the line where it occurs, and the offending character's position within that line.