DEV Community

Judy
Judy

Posted on

2 1 1 1 1

How to Extract Data from Multilayer XML Parent-Child Nodes to Form a List #79

Problem description & analysis

Below is data in XML file xml.xml:

Image description
To get categories and detailed data from the multilayer XML file and generate a two-dimensional table as follows:

Image description
Solution:

We write the following script p1.dfx in esProc:

Image description
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.

Open source SPL source address

Download

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay