This property is a Microsoft extension to the W3C DOM.
ParseError.filepos
The filepos property is read-only and contains the absolute file position where the
error occurred.
In the following example the file 'albums.xml' is loaded which includes an error: the letter
'y' has been omitted from the end of the opening 'category' tag of the first 'Album' element.
If a parse error occurs, as it does in this case, an alert displays its file position.
Note:
Where no parse error occurs, the errorCode
property returns 0.
XML:
<Albums>
<Album ref="CD720">
<categor>Pop</category>
<title>Come On Over</title>
<artist>Shania Twain</artist>
</Album>
<Album ref="CD024">
<category>Country</category>
<title>Red Dirt Girl</title>
<artist>Emmylou Harris</artist>
</Album>
</Albums>
Code (JavaScript):
xml_doc = new ActiveXObject("Microsoft.XMLDOM");
xml_doc.async = false;
xml_doc.load("albums.xml");
err = xml_doc.parseError;
if (err.errorCode != 0) alert("File Position: " + err.filepos);
The alert displays the following message:
Output:
File Position: 164
|