I have an XML file:
<?xml version="1.0" encoding="utf-8"?>
<files>
<file name="1">
<file name="4">
</file>
</file>
<file name="2">
</file>
<file name="3">
<file name="5">
<file name="7">
</file>
</file>
</file>
</files>
Now I want to create a list of strings / numbers that store the entire attribute namein a list / array with a hierarchy of nested nodes. For example, for the above XML file, the expected list is
(1,4
2
3,5,7)
Because I could know the desired node, at what level.
Could you tell me what you think about such a list?
Update: After Jon, answer, if the child nodes are in the same hierarchy, then it will be as follows.
XML file:
<files>
<file name="1">
<file name="4"/>
<file name="2">
<file name="3"/>
</file>
</file>
<file name="5"/>
and the desired result:
1,4
1,2
1,2,3
5
PS. After testing some examples, I noticed that I should have the first parent, and then the children, if there are two or more children from the same level.
user5814565