<?xml version="1.0" encoding="ascii"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>lxml.html.ElementSoup</title> <link rel="stylesheet" href="epydoc.css" type="text/css" /> <script type="text/javascript" src="epydoc.js"></script> </head> <body bgcolor="white" text="black" link="blue" vlink="#204080" alink="#204080"> <!-- ==================== NAVIGATION BAR ==================== --> <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> <tr valign="middle"> <!-- Home link --> <th> <a href="lxml-module.html">Home</a> </th> <!-- Tree link --> <th> <a href="module-tree.html">Trees</a> </th> <!-- Index link --> <th> <a href="identifier-index.html">Indices</a> </th> <!-- Help link --> <th> <a href="help.html">Help</a> </th> <!-- Project homepage --> <th class="navbar" align="right" width="100%"> <table border="0" cellpadding="0" cellspacing="0"> <tr><th class="navbar" align="center" ><a class="navbar" target="_top" href="/">lxml API</a></th> </tr></table></th> </tr> </table> <table width="100%" cellpadding="0" cellspacing="0"> <tr valign="top"> <td width="100%"> <span class="breadcrumbs"> <a href="lxml-module.html">Package lxml</a> :: <a href="lxml.html-module.html">Package html</a> :: Module ElementSoup </span> </td> <td> <table cellpadding="0" cellspacing="0"> <!-- hide/show private --> <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink" onclick="toggle_private();">hide private</a>]</span></td></tr> <tr><td align="right"><span class="options" >[<a href="frames.html" target="_top">frames</a >] | <a href="lxml.html.ElementSoup-pysrc.html" target="_top">no frames</a>]</span></td></tr> </table> </td> </tr> </table> <h1 class="epydoc">Source Code for <a href="lxml.html.ElementSoup-module.html">Module lxml.html.ElementSoup</a></h1> <pre class="py-src"> <a name="L1"></a><tt class="py-lineno"> 1</tt> <tt class="py-line"><tt id="link-0" class="py-name" targets="Variable lxml.html.ElementSoup.__doc__=lxml.html.ElementSoup-module.html#__doc__"><a title="lxml.html.ElementSoup.__doc__" class="py-name" href="#" onclick="return doclink('link-0', '__doc__', 'link-0');">__doc__</a></tt> <tt class="py-op">=</tt> <tt class="py-docstring">"""Legacy interface to the BeautifulSoup HTML parser.</tt> </tt> <a name="L2"></a><tt class="py-lineno"> 2</tt> <tt class="py-line"><tt class="py-docstring">"""</tt> </tt> <a name="L3"></a><tt class="py-lineno"> 3</tt> <tt class="py-line"> </tt> <a name="L4"></a><tt class="py-lineno"> 4</tt> <tt class="py-line"><tt class="py-name">__all__</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-string">"parse"</tt><tt class="py-op">,</tt> <tt class="py-string">"convert_tree"</tt><tt class="py-op">]</tt> </tt> <a name="L5"></a><tt class="py-lineno"> 5</tt> <tt class="py-line"> </tt> <a name="L6"></a><tt class="py-lineno"> 6</tt> <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-1" class="py-name" targets="Module lxml.html.soupparser=lxml.html.soupparser-module.html"><a title="lxml.html.soupparser" class="py-name" href="#" onclick="return doclink('link-1', 'soupparser', 'link-1');">soupparser</a></tt> <tt class="py-keyword">import</tt> <tt id="link-2" class="py-name" targets="Function lxml.html.soupparser.convert_tree()=lxml.html.soupparser-module.html#convert_tree"><a title="lxml.html.soupparser.convert_tree" class="py-name" href="#" onclick="return doclink('link-2', 'convert_tree', 'link-2');">convert_tree</a></tt><tt class="py-op">,</tt> <tt id="link-3" class="py-name" targets="Method lxml.etree._ElementTree.parse()=lxml.etree._ElementTree-class.html#parse,Function lxml.etree.parse()=lxml.etree-module.html#parse,Function lxml.html.ElementSoup.parse()=lxml.html.ElementSoup-module.html#parse,Function lxml.html.html5parser.parse()=lxml.html.html5parser-module.html#parse,Function lxml.html.soupparser.parse()=lxml.html.soupparser-module.html#parse,Function lxml.objectify.parse()=lxml.objectify-module.html#parse,Method lxml.tests.common_imports.HelperTestCase.parse()=lxml.tests.common_imports.HelperTestCase-class.html#parse"><a title="lxml.etree._ElementTree.parse lxml.etree.parse lxml.html.ElementSoup.parse lxml.html.html5parser.parse lxml.html.soupparser.parse lxml.objectify.parse lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-3', 'parse', 'link-3');">parse</a></tt> <tt class="py-keyword">as</tt> <tt id="link-4" class="py-name" targets="Function lxml.html.soupparser._parse()=lxml.html.soupparser-module.html#_parse"><a title="lxml.html.soupparser._parse" class="py-name" href="#" onclick="return doclink('link-4', '_parse', 'link-4');">_parse</a></tt> </tt> <a name="L7"></a><tt class="py-lineno"> 7</tt> <tt class="py-line"> </tt> <a name="parse"></a><div id="parse-def"><a name="L8"></a><tt class="py-lineno"> 8</tt> <a class="py-toggle" href="#" id="parse-toggle" onclick="return toggle('parse');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.html.ElementSoup-module.html#parse">parse</a><tt class="py-op">(</tt><tt class="py-param">file</tt><tt class="py-op">,</tt> <tt class="py-param">beautifulsoup</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">makeelement</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt> </div><div id="parse-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="parse-expanded"><a name="L9"></a><tt class="py-lineno"> 9</tt> <tt class="py-line"> <tt id="link-5" class="py-name" targets="Variable lxml.etree.iterparse.root=lxml.etree.iterparse-class.html#root"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-5', 'root', 'link-5');">root</a></tt> <tt class="py-op">=</tt> <tt id="link-6" class="py-name"><a title="lxml.html.soupparser._parse" class="py-name" href="#" onclick="return doclink('link-6', '_parse', 'link-4');">_parse</a></tt><tt class="py-op">(</tt><tt class="py-name">file</tt><tt class="py-op">,</tt> <tt class="py-name">beautifulsoup</tt><tt class="py-op">=</tt><tt class="py-name">beautifulsoup</tt><tt class="py-op">,</tt> <tt id="link-7" class="py-name" targets="Method lxml.etree._Element.makeelement()=lxml.etree._Element-class.html#makeelement,Method lxml.etree.iterparse.makeelement()=lxml.etree.iterparse-class.html#makeelement,Function lxml.tests.selftest2.makeelement()=lxml.tests.selftest2-module.html#makeelement"><a title="lxml.etree._Element.makeelement lxml.etree.iterparse.makeelement lxml.tests.selftest2.makeelement" class="py-name" href="#" onclick="return doclink('link-7', 'makeelement', 'link-7');">makeelement</a></tt><tt class="py-op">=</tt><tt id="link-8" class="py-name"><a title="lxml.etree._Element.makeelement lxml.etree.iterparse.makeelement lxml.tests.selftest2.makeelement" class="py-name" href="#" onclick="return doclink('link-8', 'makeelement', 'link-7');">makeelement</a></tt><tt class="py-op">)</tt> </tt> <a name="L10"></a><tt class="py-lineno">10</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt id="link-9" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-9', 'root', 'link-5');">root</a></tt><tt class="py-op">.</tt><tt id="link-10" class="py-name" targets="Method lxml.etree._ElementTree.getroot()=lxml.etree._ElementTree-class.html#getroot"><a title="lxml.etree._ElementTree.getroot" class="py-name" href="#" onclick="return doclink('link-10', 'getroot', 'link-10');">getroot</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt> </div><a name="L11"></a><tt class="py-lineno">11</tt> <tt class="py-line"> </tt><script type="text/javascript"> <!-- expandto(location.href); // --> </script> </pre> <br /> <!-- ==================== NAVIGATION BAR ==================== --> <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> <tr valign="middle"> <!-- Home link --> <th> <a href="lxml-module.html">Home</a> </th> <!-- Tree link --> <th> <a href="module-tree.html">Trees</a> </th> <!-- Index link --> <th> <a href="identifier-index.html">Indices</a> </th> <!-- Help link --> <th> <a href="help.html">Help</a> </th> <!-- Project homepage --> <th class="navbar" align="right" width="100%"> <table border="0" cellpadding="0" cellspacing="0"> <tr><th class="navbar" align="center" ><a class="navbar" target="_top" href="/">lxml API</a></th> </tr></table></th> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" width="100%%"> <tr> <td align="left" class="footer"> Generated by Epydoc 3.0.1 on Sun Sep 9 15:24:18 2018 </td> <td align="right" class="footer"> <a target="mainFrame" href="http://epydoc.sourceforge.net" >http://epydoc.sourceforge.net</a> </td> </tr> </table> <script type="text/javascript"> <!-- // Private objects are initially displayed (because if // javascript is turned off then we want them to be // visible); but by default, we want to hide them. So hide // them unless we have a cookie that says to show them. checkCookie(); // --> </script> </body> </html>