Internet Explorer (IE) is a standard software in Web browser software. We can see that almost every machine running different versions of Windows (and many other operating systems) uses IE. Microsoft has used ActiveX controls to include IE functions in sophisticated XML processing technology. In this article, we will describe how to use ActiveX functions in IE to access and parse XML documents, thus allowing IE to manipulate them.
We start with A standard document, as shown in table. This document contains simple ordered data for IE browsing. Not only to display the data, we also
Provides a simple user interface that IE can use to browse XML documents.
Table A: order. xml
9900234
1234
5.95
100
595.00
Super Widget Clamp
6234
22.00
10
220.00
Mighty Foobar Flange
9982
2.50
1000
2500.00
Deluxe Doohickie
3256
389.00
1
389.00
Muckalucket Bucket
1111
3704.00
07/07/2002
8876
We use a web form to access this XML document. This form displays the SKU, price, quantity, subtotal of each part, and descriptions of each option in the sequence. Our form also
Buttons that contain the forward and backward browsing options.
Web page Composition
An important part of a webpage is the form. We will use a table to display it on the screen in a readable manner. The following code snippet shows the HTML table:
Note that the table contains two buttons, namely, using the getDataNext () and getDataPrev () functions to browse the previous and next records. This is what we will discuss.
.
Script
In fact, the essence of our webpage is not the form, but the form control script. There are four parts in our script. First, we initialize the network by loading the XML document.
Page. The second part is to navigate to the next record. Step 3: navigate to the previous record. The fourth part is to extract a single value from the XML document. Table B shows all the content of our webpage.
Table B: jsxml.html
XML Order Database
Run
This page will pass in and run the script initialization. Make sure that the order.xmldocument and jsxml.html are in the same path.
In the initialization section, a new ActiveX object is displayed as the MSXML2.DOMDocument. 3.0 object type, and the script passes in the order. xml file to the memory, and selects all
/Order/Item node. We use the/Order/Item node to identify the options already included in the document.
InThe standard has an onLoad attribute, which can be initialized when a webpage calls getDataNext. This function can be used to obtain the next value from the XML document and display
In the form. We use a simple index to access specific options.
The forward (>) and backward (<) buttons both use the same mechanism. First, call getDataNext () or getDataPrev () in response to the onClick event. The two functions use the logical method
Avoid access to our records beyond the scope of the document.