2
by Leonard Richardson
Added an LXML builder and a stupid test. |
1 |
from BeautifulSoup import BeautifulStoneSoup, BeautifulSoup |
17
by Leonard Richardson
Reinstated ICantBelieveItsBeautifulSoup, with a test. |
2 |
from lxml_builder import LXMLTreeBuilder |
2
by Leonard Richardson
Added an LXML builder and a stupid test. |
3 |
from lxml import etree |
17
by Leonard Richardson
Reinstated ICantBelieveItsBeautifulSoup, with a test. |
4 |
builder = LXMLTreeBuilder(parser_class=etree.XMLParser) |
2
by Leonard Richardson
Added an LXML builder and a stupid test. |
5 |
soup = BeautifulStoneSoup("<foo>bar</foo>", builder=builder) |
6 |
print soup.prettify() |
|
7 |
||
8 |
soup = BeautifulSoup("<foo>bar</foo>", builder=builder) |
|
9 |
print soup.prettify() |
|
10 |
||
17
by Leonard Richardson
Reinstated ICantBelieveItsBeautifulSoup, with a test. |
11 |
builder = LXMLTreeBuilder(parser_class=etree.HTMLParser, self_closing_tags=['br']) |
15
by Leonard Richardson
Minor cleanup. |
12 |
soup = BeautifulSoup("<html><head><title>test<body><h1>page<!--Comment--><script>foo<b>bar</script><br />title</h1>", builder=builder) |
2
by Leonard Richardson
Added an LXML builder and a stupid test. |
13 |
print soup.prettify() |