Access XML data using JavaScript

xiaoxiao2021-03-06  50

In web browser software, INTERNET Explorer (IE) is now a standard software. It can be seen that every machine running different versions of Windows operating systems (and many other operating systems) almost all IEs. Microsoft has included the functionality of IE through ActiveX controls in performing mature XML processing technology.

In this article, we will tell how to use the ActiveX feature in IE to access and parse the XML document, thereby allowing the network surfers to manipulate them.

Online Surfing We start with a standard order document, as shown in Table A. This document contains simple sequential data to provide network surfers' browsing. Not only in order to display this data, we also provide a simple user interface, but also online surfes can use this interface 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 dohickie 3256 389.00 1 389.00 MUCKALUCKET BUCKET 1111 < Total> 3704.00 07/07/2002 8876

We use a web form to access this XML document, which will display SKU, price, quantity, part of each of the small counts, and the description of each option in the order. Our form also contains buttons that are forward and backward browsing options. The important part of the web page constitutes a web page is that we will use a table to be displayed on the screen in a manner. Below is a code snippet showing an HTML table:

< TD> Price
SKU
QUANTITY Total
Description

Please note that we contain two buttons below, which browsing the previous and latter records through the getDataNext () and getDataPrev () functions, which is what we have to discuss.

The script actually, the substantive part of our webpage is not the form, but is the script of the control form. In our script, four parts are included. First, we initialize the web page by loading an XML document. The second part is navigating to the next record. The third step is to navigate to the previous record. The fourth part is to extract a single value from the XML document. Table B shows all of our web pages.

Table B: jsxml.html