MobileBlur

Artifact [e2ecc8b067]
Login

Artifact [e2ecc8b067]

Artifact e2ecc8b06719b19a07b7180cd51616b1149c9988:


<?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>web2py.gluon.html.web2pyHTMLParser</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>&nbsp;&nbsp;&nbsp;<a
        href="web2py.gluon-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</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="http://www.web2py.com">web2py Web Framework</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        Package&nbsp;web2py ::
        <a href="web2py.gluon-module.html">Package&nbsp;gluon</a> ::
        <a href="web2py.gluon.html-module.html">Module&nbsp;html</a> ::
        Class&nbsp;web2pyHTMLParser
      </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&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="web2py.gluon.html.web2pyHTMLParser-class.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== CLASS DESCRIPTION ==================== -->
<h1 class="epydoc">Class web2pyHTMLParser</h1><span class="codelink"><a href="web2py.gluon.html-pysrc.html#web2pyHTMLParser">source&nbsp;code</a></span><br /><br />
<pre class="base-tree">
markupbase.ParserBase --+    
                        |    
    HTMLParser.HTMLParser --+
                            |
                           <strong class="uidshort">web2pyHTMLParser</strong>
</pre>

<hr />
obj = web2pyHTMLParser(text) parses and html/xml text into web2py 
  helpers. obj.tree contains the root of the tree, and tree can be 
  manipulated
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span>str(web2pyHTMLParser(<span class="py-string">'hello&lt;div a=&quot;b&quot; c=3&gt;wor&amp;lt;ld&lt;span&gt;xxx&lt;/span&gt;y&lt;script/&gt;yy&lt;/div&gt;zzz'</span>).tree)
<span class="py-output">'hello&lt;div a=&quot;b&quot; c=&quot;3&quot;&gt;wor&amp;lt;ld&lt;span&gt;xxx&lt;/span&gt;y&lt;script&gt;&lt;/script&gt;yy&lt;/div&gt;zzz'</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span>str(web2pyHTMLParser(<span class="py-string">'&lt;div&gt;a&lt;span&gt;b&lt;/div&gt;c'</span>).tree)
<span class="py-output">'&lt;div&gt;a&lt;span&gt;b&lt;/span&gt;&lt;/div&gt;c'</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span>tree = web2pyHTMLParser(<span class="py-string">'hello&lt;div a=&quot;b&quot;&gt;world&lt;/div&gt;'</span>).tree
<span class="py-prompt">&gt;&gt;&gt; </span>tree.element(_a=<span class="py-string">'b'</span>)[<span class="py-string">'_c'</span>]=5
<span class="py-prompt">&gt;&gt;&gt; </span>str(tree)
<span class="py-output">'hello&lt;div a=&quot;b&quot; c=&quot;5&quot;&gt;world&lt;/div&gt;'</span></pre><br /><br />

<!-- ==================== INSTANCE METHODS ==================== -->
<a name="section-InstanceMethods"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Instance Methods</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-InstanceMethods"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.html.web2pyHTMLParser-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">text</span>,
        <span class="summary-sig-arg">closed</span>=<span class="summary-sig-default"><code class="variable-group">(</code><code class="variable-quote">'</code><code class="variable-string">input</code><code class="variable-quote">'</code><code class="variable-op">, </code><code class="variable-quote">'</code><code class="variable-string">link</code><code class="variable-quote">'</code><code class="variable-group">)</code></span>)</span><br />
      Initialize and reset this instance.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.html-pysrc.html#web2pyHTMLParser.__init__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.html.web2pyHTMLParser-class.html#handle_starttag" class="summary-sig-name">handle_starttag</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">tagname</span>,
        <span class="summary-sig-arg">attrs</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.html-pysrc.html#web2pyHTMLParser.handle_starttag">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.html.web2pyHTMLParser-class.html#handle_data" class="summary-sig-name">handle_data</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">data</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.html-pysrc.html#web2pyHTMLParser.handle_data">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.html.web2pyHTMLParser-class.html#handle_charref" class="summary-sig-name">handle_charref</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">name</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.html-pysrc.html#web2pyHTMLParser.handle_charref">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.html.web2pyHTMLParser-class.html#handle_entityref" class="summary-sig-name">handle_entityref</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">name</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.html-pysrc.html#web2pyHTMLParser.handle_entityref">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="web2py.gluon.html.web2pyHTMLParser-class.html#handle_endtag" class="summary-sig-name">handle_endtag</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">tagname</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="web2py.gluon.html-pysrc.html#web2pyHTMLParser.handle_endtag">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code>HTMLParser.HTMLParser</code></b>:
      <code>check_for_whole_start_tag</code>,
      <code>clear_cdata_mode</code>,
      <code>close</code>,
      <code>error</code>,
      <code>feed</code>,
      <code>get_starttag_text</code>,
      <code>goahead</code>,
      <code>handle_comment</code>,
      <code>handle_decl</code>,
      <code>handle_pi</code>,
      <code>handle_startendtag</code>,
      <code>parse_endtag</code>,
      <code>parse_pi</code>,
      <code>parse_starttag</code>,
      <code>reset</code>,
      <code>set_cdata_mode</code>,
      <code>unescape</code>,
      <code>unknown_decl</code>
      </p>
    <p class="indent-wrapped-lines"><b>Inherited from <code>markupbase.ParserBase</code></b>:
      <code>getpos</code>,
      <code>parse_comment</code>,
      <code>parse_declaration</code>,
      <code>parse_marked_section</code>,
      <code>updatepos</code>
      </p>
    <div class="private">    <p class="indent-wrapped-lines"><b>Inherited from <code>markupbase.ParserBase</code></b> (private):
      <code>_parse_doctype_attlist</code>,
      <code>_parse_doctype_element</code>,
      <code>_parse_doctype_entity</code>,
      <code>_parse_doctype_notation</code>,
      <code>_parse_doctype_subset</code>,
      <code>_scan_name</code>
      </p></div>
    </td>
  </tr>
</table>
<!-- ==================== CLASS VARIABLES ==================== -->
<a name="section-ClassVariables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Class Variables</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-ClassVariables"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code>HTMLParser.HTMLParser</code></b>:
      <code>CDATA_CONTENT_ELEMENTS</code>
      </p>
    <div class="private">    <p class="indent-wrapped-lines"><b>Inherited from <code>markupbase.ParserBase</code></b> (private):
      <code>_decl_otherchars</code>
      </p></div>
    </td>
  </tr>
</table>
<!-- ==================== METHOD DETAILS ==================== -->
<a name="section-MethodDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Method Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-MethodDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="__init__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">text</span>,
        <span class="sig-arg">closed</span>=<span class="sig-default"><code class="variable-group">(</code><code class="variable-quote">'</code><code class="variable-string">input</code><code class="variable-quote">'</code><code class="variable-op">, </code><code class="variable-quote">'</code><code class="variable-string">link</code><code class="variable-quote">'</code><code class="variable-group">)</code></span>)</span>
    <br /><em class="fname">(Constructor)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.html-pysrc.html#web2pyHTMLParser.__init__">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  Initialize and reset this instance.
  <dl class="fields">
    <dt>Overrides:
      HTMLParser.HTMLParser.__init__
        <dd><em class="note">(inherited documentation)</em></dd>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="handle_starttag"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">handle_starttag</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">tagname</span>,
        <span class="sig-arg">attrs</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.html-pysrc.html#web2pyHTMLParser.handle_starttag">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  
  <dl class="fields">
    <dt>Overrides:
      HTMLParser.HTMLParser.handle_starttag
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="handle_data"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">handle_data</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">data</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.html-pysrc.html#web2pyHTMLParser.handle_data">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  
  <dl class="fields">
    <dt>Overrides:
      HTMLParser.HTMLParser.handle_data
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="handle_charref"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">handle_charref</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">name</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.html-pysrc.html#web2pyHTMLParser.handle_charref">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  
  <dl class="fields">
    <dt>Overrides:
      HTMLParser.HTMLParser.handle_charref
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="handle_entityref"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">handle_entityref</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">name</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.html-pysrc.html#web2pyHTMLParser.handle_entityref">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  
  <dl class="fields">
    <dt>Overrides:
      HTMLParser.HTMLParser.handle_entityref
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="handle_endtag"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">handle_endtag</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">tagname</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="web2py.gluon.html-pysrc.html#web2pyHTMLParser.handle_endtag">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  
  <dl class="fields">
    <dt>Overrides:
      HTMLParser.HTMLParser.handle_endtag
    </dt>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="web2py.gluon-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</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="http://www.web2py.com">web2py Web Framework</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.0beta1 on Thu Aug  4 00:47:01 2011
    </td>
    <td align="right" class="footer">
      <a 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>