Namespaced attributes use fully-qualified names instead of prefixes

Reported by Leonard Richardson on 2012-08-16
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Beautiful Soup
Undecided
Unassigned

Bug Description

Failing test:

    def test_namespaced_attributes(self):
        markup = '<foo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><bar xsi:schemaLocation="http://www.example.com"/></foo>'
        soup = self.soup(markup)
        self.assertEqual(unicode(soup.foo), markup)

The markup looks like this:

<foo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><bar {http://www.w3.org/2001/XMLSchema-instance}schemaLocation="http://www.example.com"/></foo>

lxml gives fully-qualified namespaces instead of namespace prefixes, and there's no code to convert back to prefixes for attribute names, the way there is for tag names.

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  Edit
Everyone can see this information.

Other bug subscribers