My question is, that how can I get the node in witch I want to insert:
I.e
<folder id="1">
<folder id="4">
<folder id="5"></folder>
</folder>
</folder>
<folder id="2">
<file id="4"/>
</folder>
<folder id="3">
</folder>
I want to get folder with id = 4, but that can be on any level.
If folders couldn’t contain one another than it would be like this myNode = xml.folder.(@id == 4).
Use the
..operator, it looks for all the nodes with given name and it doesn’t matter how deep they are. For examplexml..folderwill find all the
<folder/>nodes in your XML. So what you’re trying to do will bemyNode = xml..folder.(@id == 4).