summaryrefslogtreecommitdiff
path: root/bs4/element.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2012-07-02 16:06:54 -0400
committerLeonard Richardson <leonardr@segfault.org>2012-07-02 16:06:54 -0400
commit7b17371e76d75af684466e2d13745b683b864f5b (patch)
treeb3d7623011e8269aa9da4fa4cb20039d8e146276 /bs4/element.py
parent7a47c96f352aafcae4ad280e4d3d8456b53d7ffe (diff)
Correctly handle closing tags with an XML namespace declared. Patch by Andreas Kostyrka. [bug=1019635]
Diffstat (limited to 'bs4/element.py')
-rw-r--r--bs4/element.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/bs4/element.py b/bs4/element.py
index 91a4007..744a4e0 100644
--- a/bs4/element.py
+++ b/bs4/element.py
@@ -1000,15 +1000,16 @@ class Tag(PageElement):
attrs.append(decoded)
close = ''
closeTag = ''
- if self.is_empty_element:
- close = '/'
- else:
- closeTag = '</%s>' % self.name
prefix = ''
if self.prefix:
prefix = self.prefix + ":"
+ if self.is_empty_element:
+ close = '/'
+ else:
+ closeTag = '</%s%s>' % (prefix, self.name)
+
pretty_print = (indent_level is not None)
if pretty_print:
space = (' ' * (indent_level - 1))
@@ -1120,6 +1121,7 @@ class Tag(PageElement):
callable that takes a string and returns whether or not the
string matches for some custom definition of 'matches'. The
same is true of the tag name."""
+
generator = self.descendants
if not recursive:
generator = self.children