How to Parse XML in VBScript
XML provides standard formatting for several different languages, so you can parse, export and edit data across different Web and database languages. VBScript is an older language used in Classic ASP. VBScript includes an XML parsing class you use to read XML files on a Web server. You can then edit the data or display the information for your website readers and customers.
Instructions
-
-
1
Right-click the Classic ASP file you want to edit that contains the VBScript code. Click "Open With" and select your VBScript programming software. You can edit old Classic ASP code in Visual Studio or older Classic ASP development software.
-
2
Create the ActiveX object. VBScript uses ActiveX components, and you must define the XML parser before opening the document. The following code adds the parser class object:
set xml = Server.CreateObject("Microsoft.XMLDOM")
-
-
3
Load the document into the new xml variable. The following code opens a document named "myxml.xml":
xml.load("myxml.xml")
-
4
Parse the XML elements. The following code retrieves the first element and displays the value to the website reader:
customerid = xml.getElementsByTagName("customerid")
Repsonse.Write(customerid)
-
1