summaryrefslogtreecommitdiff
path: root/lxml_test.py
blob: 99375dd776bcb8c017899fe5abf74db4d93d7b4b (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<br />title</h1>", builder=builder)
print soup.prettify()