Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project











PROPERTY:  ParseError::linepos

This property is a Microsoft extension to the W3C DOM.

ParseError.linepos

The linepos property is read-only and contains the position within the line of the character causing the parse error.

In the following 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.

Note:
Where no parse error occurs, the errorCode property returns 0.

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>

Code (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);

The alert displays the following message:

Output:
Line: 10
Line Position: 25



 


Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information