ePc@sdZdddgZddlmZmZddlmZmZmZmZm Z dddZ dddZ dd Z d Zd Zd Zd ZyddlmZWn!ek rddlmZnXddlZejdjZdZdS(s5External interface to the BeautifulSoup HTML parser. t fromstringtparset convert_treei(tetreethtml(t BeautifulSouptTagtCommenttProcessingInstructiontNavigableStringcKst||||S(sParse a string of HTML data into an Element tree using the BeautifulSoup parser. Returns the root ```` Element of the tree. You can pass a different BeautifulSoup parser through the `beautifulsoup` keyword, and a diffent Element factory function through the `makeelement` keyword. By default, the standard ``BeautifulSoup`` class and the default factory of `lxml.html` are used. (t_parse(tdatat beautifulsoupt makeelementtbsargs((s:/usr/lib64/python2.7/site-packages/lxml/html/soupparser.pyR s cKs@t|dst|}nt||||}tj|S(sYParse a file into an ElemenTree using the BeautifulSoup parser. You can pass a different BeautifulSoup parser through the `beautifulsoup` keyword, and a diffent Element factory function through the `makeelement` keyword. By default, the standard ``BeautifulSoup`` class and the default factory of `lxml.html` are used. tread(thasattrtopenR Rt ElementTree(tfileR R Rtroot((s:/usr/lib64/python2.7/site-packages/lxml/html/soupparser.pyRs cCsX|dkrtjj}nt||}|j}x|D]}|j|q=W|S(sConvert a BeautifulSoup tree to a list of Element trees. Returns a list instead of a single root Element to support HTML-like soup with more than one root element. You can pass a different Element factory through the `makeelement` keyword. N(tNoneRt html_parserR t _convert_treet getchildrentremove(tbeautiful_soup_treeR Rtchildrentchild((s:/usr/lib64/python2.7/site-packages/lxml/html/soupparser.pyR's   cKs|dkrt}n|dkr0tjj}nd|krId|ds"(