diff options
author | Leonard Richardson <leonardr@segfault.org> | 2018-12-24 09:54:10 -0500 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2018-12-24 09:54:10 -0500 |
commit | 50ded6dbdfeba182233fff86eb98513e09fcde93 (patch) | |
tree | 5f05f605ac955b91b00d47d6c022c01fc0327d3b /bs4/__init__.py | |
parent | d065751cdab7877feeffbd0f798819ef77a2aa66 (diff) |
Keep track of the namespace abbreviations found while parsing the document. This makes select() work most of the time without requiring a value for 'namespaces'.
Diffstat (limited to 'bs4/__init__.py')
-rw-r--r-- | bs4/__init__.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bs4/__init__.py b/bs4/__init__.py index 087ee69..ea9d9eb 100644 --- a/bs4/__init__.py +++ b/bs4/__init__.py @@ -237,10 +237,11 @@ class BeautifulSoup(Tag): self.builder = builder self.is_xml = builder.is_xml self.known_xml = self.is_xml - self.builder.soup = self - + self._namespaces = dict() self.parse_only = parse_only + self.builder.initialize_soup(self) + if hasattr(markup, 'read'): # It's a file-type object. markup = markup.read() elif len(markup) <= 256 and ( |