Get all ID linked to a parent element with lxml python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

25th May 2020, 8:09 AM
GeraltdeRivia
3 Answers
+ 1
Okay.
5th Jun 2020, 4:44 AM
Thameem Jabir KJ
Thameem Jabir KJ - avatar
0
I didn't understand ur qstn. Is it u want the values of each id attributes??
4th Jun 2020, 8:15 PM
Thameem Jabir KJ
Thameem Jabir KJ - avatar
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.
4th Jun 2020, 10:33 PM
GeraltdeRivia