Namespace not honered in find_all

Bug #1655332 reported by delijati
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Beautiful Soup
Fix Released

Bug Description

Namespace are not honored in find_all when using "xml":


import bs4

doc = """<?xml version="1.0" encoding="utf-8"?>
<Foo xmlns=""
        <uxc:InPort name="COD_DUNS_NUMBER_Info_In">
            <uxc:Parameter name="CompanyName">
            <uxc:Parameter name="EntityId">
        <mashup:Parameter constant="far2" context="query" name="bloo"/>

dom = bs4.BeautifulSoup(doc, "lxml-xml")
# How to search only for mashup elements?
# find_all('mashup:Parameter') does not work
elements = dom.find_all("Parameter")
print([x.prefix for x in elements])

Revision history for this message
delijati (delijati) wrote :

Found a way:

params = dom.find_all(
    lambda tag: ( == "Parameter" and
        tag.prefix == "mashup")

Revision history for this message
Leonard Richardson (leonardr) wrote :

Feature added in revision 442.

Changed in beautifulsoup:
status: New → Fix Committed
Changed in beautifulsoup:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.