summaryrefslogtreecommitdiff
path: root/beautifulsoup/element.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonard.richardson@canonical.com>2011-02-11 09:10:56 -0500
committerLeonard Richardson <leonard.richardson@canonical.com>2011-02-11 09:10:56 -0500
commitd0531c4204a67a4289025bf7108a922f680fa057 (patch)
treecdad3f97812e658d84a611b6017b7198fd97d818 /beautifulsoup/element.py
parent3366ad67dc2dfdd508267efc87dfc851b612fb0d (diff)
parentd89c8878ea86a2575c87e9fad8081cfcd81e0bcd (diff)
Ported some more tests, fixed an encoding problem, and added rudimentary doctype handling.
Diffstat (limited to 'beautifulsoup/element.py')
-rw-r--r--beautifulsoup/element.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/beautifulsoup/element.py b/beautifulsoup/element.py
index bd9bcbf..b2e0e12 100644
--- a/beautifulsoup/element.py
+++ b/beautifulsoup/element.py
@@ -346,9 +346,6 @@ class NavigableString(unicode, PageElement):
else:
raise AttributeError, "'%s' object has no attribute '%s'" % (self.__class__.__name__, attr)
- def encode(self, encoding=DEFAULT_OUTPUT_ENCODING):
- return self.decode().encode(encoding)
-
def decodeGivenEventualEncoding(self, eventualEncoding):
return self
@@ -373,6 +370,11 @@ class Declaration(NavigableString):
def decodeGivenEventualEncoding(self, eventualEncoding):
return u'<!' + self + u'>'
+class Doctype(NavigableString):
+
+ def decodeGivenEventualEncoding(self, eventualEncoding):
+ return u'<!DOCTYPE ' + self + u'>'
+
class Tag(PageElement, Entities):
"""Represents a found HTML tag with its attributes and contents."""