August 5, 2009

0 XML Parser

To read and update - create and manipulate - an XML document, you will need an XML parser,

Microsoft' s XML Parser

Microsoft's XML parser is a COM component that comes with internet explorer 5 and higher. Once you have installed Internet Explorer, the parser is available to scripts.

Microsoft's XML parser supports all the necessary functions to traverse the node tree, access the nodes and their attribute values, insert and delete nodes, and convert the node tree back to XML.

The following table lists the most commonly used node types supported by Microsoft's XML parser:

Node Type Example

Processing Instruction <?xml version="1.0"?>

Element <drink type="beer"&gt;Carlsberg</drink>

Attribute type="beer"

Text Carlsberg

MSXML Parser 2.5 is the XML parser that is shipped with windows 2000 and IE 5.5.

MSXML Parser 3.0 is the XML parser that is shipped with IE 6.0 and Windows XP.

The MSXML 3.0 parser features:

Javascript, VBScript, Perl, VB, Java, C++, etc. support

Complete XML Support

Full DOM and Namespace support

DTD and validation

Complete XSLT and XPATH support

SAX2 support

Server-safe HTTP

TO Create an instance of Microsoft's XML parser with Javascript, use the following code:

var xmlDoc=new ActiveXObject("Microsoft.XMLDOM")

To create an instance of Microsoft's XML parser with VBScript, use the following code

set xmlDoc=CreateObject("Microsoft.XMLDOM")

To create an instance of Microsoft's XML parser in an ASP Page (using VBScript), use the following code:

set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")

the following code loads an existing XML document ("note.xml") into Microsoft's XML parser:

<script type ="text/javascript">

var xmlDoc=new ActiveXObject("Microsoft.XMLDOM")



The first line of the script above creates an instance of the Microsoft XML parser. The third line tells the parser to load an XML document called "note.xml". The second line turns off asynchronised loading, to make sure that the parser will not continue execution of the script before the document is fully loaded.


Post a Comment

Blogger Themes

Powered by Blogger