How to Extract Data from Multilayer XML Parent-Child Nodes to Form a List
Problem description & analysis
Below is data in XML file xml.xml:
To get categories and detailed data from the multilayer XML file and generate a two-dimensional table as follows:
Solution:
We write the following script p1.dfx in esProc:
A |
|
1 |
=file("xml.xml").read() |
2 |
=xml(A1,"xml/li/form") |
3 |
=A2.news(p.select.option;h3:name,~:time) |
4 |
=file("result.txt").export@t(A3) |
Code description:
A1 Read data of the XML file as a string.
A2 Use xml function to get data of form layer and return it as a table sequence.
A3 Extend the multiple p.select.option values in table sequence A2 and concatenate them to generate a new table sequence.
A4 Export A3’s result to result.txt.
result.txt is the expected result after the script is executed.
https://stackoverflow.com/questions/63684666/vba-scraping-data-in-ticketing
SPL Official Website 👉 https://www.scudata.com
SPL Feedback and Help 👉 https://www.reddit.com/r/esProc_SPL
SPL Learning Material 👉 https://c.scudata.com
SPL Source Code and Package 👉 https://github.com/SPLWare/esProc
Discord 👉 https://discord.gg/cFTcUNs7
Youtube 👉 https://www.youtube.com/@esProc_SPL