python - How to find children of an XML element with a given attribute? -


what wrong search term (using elementtree)?

matches = root.findall(".//{http://www.w3.org/2000/svg}g[@id='" + sid + "']/circle") 

i no matches. element in question has 'circle' child , works fine (without circle):

matches = root.findall(".//{http://www.w3.org/2000/svg}g[@id='" + sid + "']") 

with above i'll match. i'm following advice here (see examples section). example no different example

root.findall(".//*[@name='singapore']/year") 

ah! silly mistake, these svg elements, solution follows:

matches = root.findall(".//{http://www.w3.org/2000/svg}g[@id='" + sid + "']/{http://www.w3.org/2000/svg}circle") 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -