Home > Software engineering >  Get all the content of the XML under the specified node
Get all the content of the XML under the specified node

Time:10-17

Such as: see below, how to get all the content under the specified XML node, and displayed in a table form
XML documents have list1 and list2 these two nodes, I just want to get list1 below two records, and displayed in the form controls, how to do? (figure in the table in the control's content, to illustrate the effect of mandatory added manually, not by XML file read)





The following for the content of the XML document:

<? The XML version="1.0" encoding="utf-8"?>
- & lt; Mkryxx>
Y
- & lt; List1 & gt;
- & lt; The item id="1" & gt;
Lily A
532526271986030301 a & lt;/sfzh>
Female A
The 1986-3-3 0:00:00 A
A
A

- & lt; The item id="2" & gt;
Wang Lihong & lt;/xm>
532526271986030301 a & lt;/sfzh>
Female A1 & lt;/xb>
The 1986-3-3 0:00:00 A1 & lt;/csrq>
A1 & lt;/lxdh>
A1 & lt;/xxdz>

- & lt; List2 & gt;
- & lt; The item id="1" & gt;
Zhangjiang & lt;/xm>
532526271986030301 b1 & lt;/sfzh>
Female & lt;/xb>
The 1986-3-3 0:00:00 B1 & lt;/csrq>
B1 & lt;/lxdh>
B1 & lt;/xxdz>

- & lt; The item id="2" & gt;
Sun jian & lt;/xm>
532526271986030301 b2 & lt;/sfzh>
Female B2 & lt;/xb>
The 1986-3-3 0:00:00 B2 & lt;/csrq>
B2 & lt;/lxdh>
B2 & lt;/xxdz>

CodePudding user response:

 
Sub Command1_Click ()
Set the Dom=CreateObject (" Microsoft. XMLDOM)
Dom. Async=False
The Dom. The Load "C: \ Documents and Settings \ Administrator \ \ desktop a.x ml"
Set the Node=Dom. SelectSingleNode (" mkryxx "). SelectSingleNode (" list1 ")..childnodes (1)
For Each Node In x..childnodes
The Debug. Print x.T ext
Next
End Sub

CodePudding user response:

Useful to me, thank you!
  • Related