summaryrefslogtreecommitdiff
path: root/bs4/builder/_lxml.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2014-12-11 22:23:26 -0500
committerLeonard Richardson <leonardr@segfault.org>2014-12-11 22:23:26 -0500
commit5bd09164de9b5a45ffea4171968b8186dcdc6f69 (patch)
tree0784b1c3e6ef5a803d9323e056d14bbbc07ebc06 /bs4/builder/_lxml.py
parent3c133d8d12f314ff3d70195cc0422e8e087b7829 (diff)
Improved the lxml tree builder's handling of processing
instructions. [bug=1294645]
Diffstat (limited to 'bs4/builder/_lxml.py')
-rw-r--r--bs4/builder/_lxml.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/bs4/builder/_lxml.py b/bs4/builder/_lxml.py
index 978c8df..b0bc8a0 100644
--- a/bs4/builder/_lxml.py
+++ b/bs4/builder/_lxml.py
@@ -7,7 +7,12 @@ from io import BytesIO
from StringIO import StringIO
import collections
from lxml import etree
-from bs4.element import Comment, Doctype, NamespacedAttribute
+from bs4.element import (
+ Comment,
+ Doctype,
+ NamespacedAttribute,
+ ProcessingInstruction,
+)
from bs4.builder import (
FAST,
HTML,
@@ -191,7 +196,9 @@ class LXMLTreeBuilderForXML(TreeBuilder):
self.nsmaps.pop()
def pi(self, target, data):
- pass
+ self.soup.endData()
+ self.soup.handle_data(target + ' ' + data)
+ self.soup.endData(ProcessingInstruction)
def data(self, content):
self.soup.handle_data(content)