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::line

This property is a Microsoft extension to the W3C DOM.

ParseError.line

The line property is read-only and returns the number of the line that contains the parse error.

In the following example the file 'staff.xml' is loaded which includes an error: the second employee element does not include an 'ssn' attribute which is required by the DTD. If a parse error occurs, as it does in this case, an alert displays the number of the line where it occurs.

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>
      <name>Mary Lopez</name>
      <position>personal assistant</position>
   </employee>
</staff>

Code (VBScript):
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load("staff.xml")
Set ParseErr = objXMLDoc.parseError
If ParseErr.errorCode <> 0 Then
   alert("Error Line: " & ParseErr.line)
End If

The alert displays the following message:

Output:
Error Line: 9



 


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