Data. XML data file
1 <? XML version = "1.0" encoding = "UTF-8" ?>
2 < Root >
3 < Row ID = "1" Compname = "Dalian" Post = "063000" Tel = "0315-2695" Level = "888888888" />
4 < Row ID = "2" Compname = "Tianjun" Post = "063000" Tel = "0315-2695" Level = "888888888" />
5 < Row ID = "3" Compname = "Beijin" Post = "063000" Tel = "0315-2695" Level = "888888888" />
6 </ Root >
ReadProgramI. traverse all nodes
< %
Dim XML, objnode, objasd, ncntchd, ncntatr
Set XML = Server. Createobject ( " Microsoft. xmldom " )
XML. async = False
XML. Load (server. mappath ( " Data. xml " ))
Set Objnode = Xml.doc umentelement
Ncntchd = Objnode. childnodes. Length - 1
For I = 0 To Ncntchd
Set Objrecognition = Objnode. childnodes. Item (I)
Ncntatr = Objasd. Attributes. Length - 1
For J = 0 To Ncntatr
Response. Write objret. Attributes. Item (j). Text & " <Br> "
Next
Response. Write " <Br> "
Next
Response. Write " <Br> "
Set Objrecognition = Nothing
Set Objnode = Nothing
Set XML = Nothing
% >
Read Program 2: Get the content of the "compname" Node
< %
Dim XML, objnode, objasd, ncntchd, ncntatr
Set XML = Server. Createobject ( " Microsoft. xmldom " )
XML. async = False
XML. Load (server. mappath ( " Data. xml " ))
Set Objnode = Xml.doc umentelement
Ncntchd = Objnode. childnodes. Length - 1
For I = 0 To Ncntchd
Set Objrecognition = Objnode. childnodes. Item (I)
Ncntatr = Objasd. Attributes. Length - 1
Response. Write objret. Attributes. Item ( I ). Text & " <Br> "
Next
Response. Write " <Br> "
Set Objrecognition = Nothing
Set Objnode = Nothing
Set XML = Nothing
% >