Get all ID linked to a parent element with lxml python | SoloLearn: Learn to code for FREE!

0

Get all ID linked to a parent element with lxml python

I have this situation where I need to get all the id in an xml that are linked to a liat of elements. The Xml structure would be. <content id="title001"> <content-link id="brf233" /> <content-link id="de882" /> </content> <content id="brf233"> <content-link id="re23" /> </content> I don't know how to read all the linked elements from the root. It is clearly a tree structure where each id is unique as well. It cannot be graph like structure. I know how to read an element but I don't know how to go deep in the tree. https://code.sololearn.com/cqpSH21c10D4/?ref=app

5/25/2020 8:09:24 AM

GeraltdeRivia

3 Answers

New Answer

+1

0

I didn't understand ur qstn. Is it u want the values of each id attributes??

0

Yeah, sorry it waa finally solved. I did not go back to this question. And I wanted to get all id of linked elements.