Retrieving XML documents and returning two-dimensional arrays (ASP) (updated version)
Source: Internet
Author: User
<% On error resume next
'<! [CDATA []> problem not handled
'Xmlfile = "???. Xml"
Set xml = Server. CreateObject ("MSXML. DOMDocument ")
Xml. async = false
Xml. load (xmlfile)
Public Function PrettyPrint (node, tabLevel)
On error resume next
If node. nodeName <> vbNullStrin And node. nodeName <> "# text" Then
PrettyPrint = PrettyPrint & tabLevel & "[sp2] 0 [sp2]" + node. nodeName + "[sp1]"
For Each I In node. Attributes
Pstr = pstr + I. Name + "=" + I. Value + ""
Next
PrettyPrint = PrettyPrint & tabLevel & "[sp2] 2 [sp2]" + pstr + "[sp1]"
End If
If node. hasChildNodes Then
For Each childNode In node. childNodes
TabLevel = tabLevel + 1
PrettyPrint = PrettyPrint + PrettyPrint (childNode, tabLevel)
Next
Else
PrettyPrint = PrettyPrint & tabLevel-1 & "[sp2] 1 [sp2]" + node. Text + "[sp1]"
End If
End Function
Public Function ShowXml (s)
On error resume next
Ta = split (s, "[sp1]")
K = ubound (ta)-1
'Response. write "sta (" & k & ", 2) <p>"
Redim sta (k, 2)
For I = 0 to k
Ta2 = split (ta (I), "[sp2]")
Cs1 = ta2 (0)
Cs2 = ta2 (1)
Cs3 = ta2 (2)
'Response. write "sta (" & cs1 & "," & cs2 & ") =" & cs3 & "<br>"
Sta (cs1, cs2) = cs3
Next
ShowXml = sta
End Function
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service