Namespace not honered in find_all
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Beautiful Soup |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Namespace are not honored in find_all when using "xml":
Example:
import bs4
doc = """<?xml version="1.0" encoding="utf-8"?>
<Foo xmlns="http://
xmlns:mashup="http://
xmlns:uxc="http://
<uxc:InPorts>
<uxc:InPort name="COD_
<uxc:InPorts>
<mashup:
</mashup:
</Foo>
"""
dom = bs4.BeautifulSo
# How to search only for mashup elements?
# find_all(
elements = dom.find_
print(elements)
print([x.prefix for x in elements])
Changed in beautifulsoup: | |
status: | Fix Committed → Fix Released |
Found a way:
params = dom.find_all(
lambda tag: (
tag.name == "Parameter" and
tag.prefix == "mashup")
)