Reputation: 1041
I am trying to extract the section of government bill data, such as this https://www.govtrack.us/data/congress/113/bills/sconres/sconres14/text-versions/is/document.xml. I only want the text from the section, but can't figure how how to navigate to it using python's xml.etree.ElementTree; the equivalent javascript would be something like getElementbyTagName.
Upvotes: 0
Views: 434
Reputation: 89285
In xml.etree.ElementTree
, you can use findall()
passing XPath expression string as parameter, to find elements with certain criteria. So, for simple element names (those that doesn't contain prefix), the equivalent of Javascript's getElementbyTagName("elementName")
in ElementTree
would be findall(".//tagName")
.
Upvotes: 1