summaryrefslogtreecommitdiff
path: root/lxml_test.py
blob: 77c04e861391ebff5d13ae3529cba2ef3588be10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
from BeautifulSoup import BeautifulStoneSoup, BeautifulSoup
from lxml_builder import LXMLBuilder
from lxml import etree
builder = LXMLBuilder()
soup = BeautifulStoneSoup("<foo>bar</foo>", builder=builder)
print soup.prettify()

soup = BeautifulSoup("<foo>bar</foo>", builder=builder)
print soup.prettify()

builder = LXMLBuilder(parser_class=etree.HTMLParser, self_closing_tags=["br"])
soup = BeautifulSoup("<html><head><title>test<body><h1>page<script>foo<b>bar</script><br />title</h1>", builder=builder)
print soup.prettify()