Finding and storing children of roots in Beautiful Soup

I'm trying to find and store the children

<orgname>

from the parent

<assignee>

. My code so far runs through the XML document already picking up certain other tags - I have set it up as such:

for xml_string in separated_xml(infile): # Calls the output of the separated and read file to parse the data
soup = BeautifulSoup(xml_string, "lxml") # BeautifulSoup parses the data strings where the XML is converted to Unicode
pub_ref = soup.findAll("publication-reference") # Beginning parsing at every instance of a publication

I already have this in sequence so that each invention name and patent pairs and need the organization assignee name along with it. Problem is that there are other tags associated with things like attorneys and such organizations looking like this:

assign = soup.findAll("assignee") returns a list , so that's why calling org_name = assign.findAll("orgname") fails, you'd have to go through each element of assign and call it's .findAll("orgname"), but it seems there's only one <orgname> in each <assignee>, so there's no need to use .findAll instead of .find. Try using .find to each element of assign using list comprehension:

orgnames = [item.find("orgname") for item in assign]

Or, to directly get their texts, checking before if the <orgname> exists within that <assignee>:

orgnames = [item.find("orgname").text for item in assign if item.find("orgname")]