XML Tutorials - Herong's Tutorial Notes
Dr. Herong Yang, Version 4.00

Using Internet Explorer as an XML Syntax Checker

This section provides a tutorial example on how to use IE (Internet Explorer) as an XML file syntax checker. If there are syntax errors in an XML file, IE will stop displaying the XML file at the first error location.

Internet Explorer can also be used as an XML syntax checker.

Look at the following XML file, incorrect.xml

<?xml version="1.0"?>
<!-- incorrect.xml
   Copyright (c) 2002 by Dr. Herong Yang. http://www.herongyang.com/
-->
<dictionary>
 <word>
  <update date="2002-12-23"/>
  <name is_acronym="true">XML</Name>
  <description>eXtensible Markup Language</description>
 </word>
 <word>
  <update date="2002-12-23"/>
  <name is_acronym="true">POP</name>
  <definition default>Post Office Protocol</definition>
  <definition>Point Of Purchase</definition>
</dictionary>

Do you know how many syntax errors are in this XML file?

If you open incorrect.xml with IE, you will see this:

The XML page cannot be displayed 
Cannot view XML input using XSL style sheet. Please correct the error
and then click the Refresh button, or try again later. 
------------------------------------------------------------------------

End tag 'Name' does not match the start tag 'name'. 
Error processing resource 'file:///C:/herong/xml/incorrect.xml'. 
Line 8, Position 32 

  <name is_acronym="true">XML</Name>
-------------------------------^

This is almost perfect.

  • It tells you what is the error: "End tag 'Term does not match the start tag 'term'." Remember element tags are case sensitive.
  • It also tells you where is the error: "Line 8, Position 32".
  • But it only tells the first error. To see the other errors you must correct the first one, and re-open the file again in IE.

Exercise: Fix all the syntax errors in incorrect.xml.

Table of Contents

 About This Book

 Introduction of XML (eXtensible Markup Language)

 XML File Syntax

XML File Browsers

 Using Internet Explorer as an XML Browser

Using Internet Explorer as an XML Syntax Checker

 Using Mozilla Firefox as an XML Browser

 Using Mozilla Firefox as an XML Syntax Checker

 XML Spy and Other XML Browsers

 DOM (Document Object Model) Programming Interface

 SAX (Simple API for XML) Programming Interface

 DTD (Document Type Definition) Introduction

 Syntaxes of DTD Statements

 Validating an XML Document against the Specified DTD Document Type

 XSD (XML Schema Definition) Introduction

 Syntaxes of XSD Statements

 Validating an XML Document against the Specified XML Schema

 XSL (Extensible Stylesheet Language) Introduction

 XSLT (XSL Transformations) Introduction

 Java Implementation of XSLT

 XPath (XML Path) Language

 XSLT Elements as Programming Statements

 Control and Generate XML Element in the Result

 References

 Printable Copy - PDF Version

Dr. Herong Yang, updated in 2009
Using Internet Explorer as an XML Syntax Checker