From 41c2b7c056e73c63c872eeb0a5e3a1f65473eaf0 Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Sun, 21 Jul 2019 15:50:49 -0400 Subject: Implemented line number tracking for html5lib. --- bs4/builder/_lxml.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'bs4/builder/_lxml.py') diff --git a/bs4/builder/_lxml.py b/bs4/builder/_lxml.py index 27cadcb..85be1b5 100644 --- a/bs4/builder/_lxml.py +++ b/bs4/builder/_lxml.py @@ -57,6 +57,12 @@ class LXMLTreeBuilderForXML(TreeBuilder): DEFAULT_NSMAPS_INVERTED = _invert(DEFAULT_NSMAPS) + # NOTE: If we parsed Element objects and looked at .sourceline, + # we'd be able to see the line numbers from the original document. + # But instead we build an XMLParser or HTMLParser object to serve + # as the target of parse messages, and those messages don't include + # line numbers. + def initialize_soup(self, soup): """Let the BeautifulSoup object know about the standard namespace mapping. -- cgit v1.2.3