1 <?xml version="1.0" encoding="ascii"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3 "DTD/xhtml1-transitional.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6 <title>lxml.html.HtmlElement</title>
7 <link rel="stylesheet" href="epydoc.css" type="text/css" />
8 <script type="text/javascript" src="epydoc.js"></script>
11 <body bgcolor="white" text="black" link="blue" vlink="#204080"
13 <!-- ==================== NAVIGATION BAR ==================== -->
14 <table class="navbar" border="0" width="100%" cellpadding="0"
15 bgcolor="#a0c0ff" cellspacing="0">
18 <th> <a
19 href="lxml-module.html">Home</a> </th>
22 <th> <a
23 href="module-tree.html">Trees</a> </th>
26 <th> <a
27 href="identifier-index.html">Indices</a> </th>
30 <th> <a
31 href="help.html">Help</a> </th>
33 <!-- Project homepage -->
34 <th class="navbar" align="right" width="100%">
35 <table border="0" cellpadding="0" cellspacing="0">
36 <tr><th class="navbar" align="center"
37 ><a class="navbar" target="_top" href="/">lxml API</a></th>
41 <table width="100%" cellpadding="0" cellspacing="0">
44 <span class="breadcrumbs">
48 Class HtmlElement
52 <table cellpadding="0" cellspacing="0">
53 <!-- hide/show private -->
54 <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
55 onclick="toggle_private();">hide private</a>]</span></td></tr>
56 <tr><td align="right"><span class="options"
57 >[<a href="frames.html" target="_top">frames</a
58 >] | <a href="lxml.html.HtmlElement-class.html"
59 target="_top">no frames</a>]</span></td></tr>
64 <!-- ==================== CLASS DESCRIPTION ==================== -->
65 <h1 class="epydoc">Class HtmlElement</h1><p class="nomargin-top"><span class="codelink"><a href="lxml.html-pysrc.html#HtmlElement">source code</a></span></p>
66 <pre class="base-tree">
69 <a href="lxml.etree._Element-class.html" onclick="show_private();">etree._Element</a> --+
71 <a href="lxml.etree.ElementBase-class.html">etree.ElementBase</a> --+
75 <a href="lxml.html.HtmlMixin-class.html">HtmlMixin</a> --+
77 <strong class="uidshort">HtmlElement</strong>
80 <dl><dt>Known Subclasses:</dt>
82 <ul class="subclass-list">
83 <li><a href="lxml.html.FormElement-class.html">FormElement</a></li><li>, <a href="lxml.html.InputElement-class.html">InputElement</a></li><li>, <a href="lxml.html.LabelElement-class.html">LabelElement</a></li><li>, <a href="lxml.html.SelectElement-class.html">SelectElement</a></li><li>, <a href="lxml.html.TextareaElement-class.html">TextareaElement</a></li> </ul>
87 <!-- ==================== INSTANCE METHODS ==================== -->
88 <a name="section-InstanceMethods"></a>
89 <table class="summary" border="1" cellpadding="3"
90 cellspacing="0" width="100%" bgcolor="white">
91 <tr bgcolor="#70b0f0" class="table-header">
92 <td colspan="2" class="table-header">
93 <table border="0" cellpadding="0" cellspacing="0" width="100%">
95 <td align="left"><span class="table-header">Instance Methods</span></td>
96 <td align="right" valign="top"
97 ><span class="options">[<a href="#section-InstanceMethods"
98 class="privatelink" onclick="toggle_private();"
99 >hide private</a>]</span></td>
105 <td width="15%" align="right" valign="top" class="summary">
106 <span class="summary-type"> </span>
107 </td><td class="summary">
108 <table width="100%" cellpadding="0" cellspacing="0" border="0">
110 <td><span class="summary-sig"><a href="lxml.html.HtmlElement-class.html#cssselect" class="summary-sig-name">cssselect</a>(<span class="summary-sig-arg">self</span>,
111 <span class="summary-sig-arg">expr</span>,
112 <span class="summary-sig-arg">translator</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">html</code><code class="variable-quote">'</code></span>)</span><br />
113 Run the CSS expression on this element and its children,
114 returning a list of the results.</td>
115 <td align="right" valign="top">
116 <span class="codelink"><a href="lxml.html-pysrc.html#HtmlElement.cssselect">source code</a></span>
125 <td width="15%" align="right" valign="top" class="summary">
126 <span class="summary-type"> </span>
127 </td><td class="summary">
128 <table width="100%" cellpadding="0" cellspacing="0" border="0">
130 <td><span class="summary-sig"><a href="lxml.html.HtmlElement-class.html#set" class="summary-sig-name">set</a>(<span class="summary-sig-arg">self</span>,
131 <span class="summary-sig-arg">key</span>,
132 <span class="summary-sig-arg">value</span>=<span class="summary-sig-default">None</span>)</span><br />
133 Sets an element attribute. If no value is provided, or if the value is None,
134 creates a 'boolean' attribute without value, e.g. "<form novalidate></form>"
135 for <tt class="rst-docutils literal"><span class="pre">form.set('novalidate')</span></tt>.</td>
136 <td align="right" valign="top">
137 <span class="codelink"><a href="lxml.html-pysrc.html#HtmlElement.set">source code</a></span>
146 <td colspan="2" class="summary">
147 <p class="indent-wrapped-lines"><b>Inherited from <code><a href="lxml.etree.ElementBase-class.html">etree.ElementBase</a></code></b>:
148 <code><a href="lxml.etree.ElementBase-class.html#__init__">__init__</a></code>,
149 <code><a href="lxml.etree.ElementBase-class.html#__new__">__new__</a></code>
151 <p class="indent-wrapped-lines"><b>Inherited from <code><a href="lxml.etree._Element-class.html" onclick="show_private();">etree._Element</a></code></b>:
152 <code><a href="lxml.etree._Element-class.html#__contains__">__contains__</a></code>,
153 <code><a href="lxml.etree._Element-class.html#__copy__">__copy__</a></code>,
154 <code><a href="lxml.etree._Element-class.html#__deepcopy__">__deepcopy__</a></code>,
155 <code><a href="lxml.etree._Element-class.html#__delitem__">__delitem__</a></code>,
156 <code><a href="lxml.etree._Element-class.html#__getitem__">__getitem__</a></code>,
157 <code><a href="lxml.etree._Element-class.html#__iter__">__iter__</a></code>,
158 <code><a href="lxml.etree._Element-class.html#__len__">__len__</a></code>,
159 <code><a href="lxml.etree._Element-class.html#__nonzero__">__nonzero__</a></code>,
160 <code><a href="lxml.etree._Element-class.html#__repr__">__repr__</a></code>,
161 <code><a href="lxml.etree._Element-class.html#__reversed__">__reversed__</a></code>,
162 <code><a href="lxml.etree._Element-class.html#__setitem__">__setitem__</a></code>,
163 <code><a href="lxml.etree._Element-class.html#addnext">addnext</a></code>,
164 <code><a href="lxml.etree._Element-class.html#addprevious">addprevious</a></code>,
165 <code><a href="lxml.etree._Element-class.html#append">append</a></code>,
166 <code><a href="lxml.etree._Element-class.html#clear">clear</a></code>,
167 <code><a href="lxml.etree._Element-class.html#extend">extend</a></code>,
168 <code><a href="lxml.etree._Element-class.html#find">find</a></code>,
169 <code><a href="lxml.etree._Element-class.html#findall">findall</a></code>,
170 <code><a href="lxml.etree._Element-class.html#findtext">findtext</a></code>,
171 <code><a href="lxml.etree._Element-class.html#get">get</a></code>,
172 <code><a href="lxml.etree._Element-class.html#getchildren">getchildren</a></code>,
173 <code><a href="lxml.etree._Element-class.html#getiterator">getiterator</a></code>,
174 <code><a href="lxml.etree._Element-class.html#getnext">getnext</a></code>,
175 <code><a href="lxml.etree._Element-class.html#getparent">getparent</a></code>,
176 <code><a href="lxml.etree._Element-class.html#getprevious">getprevious</a></code>,
177 <code><a href="lxml.etree._Element-class.html#getroottree">getroottree</a></code>,
178 <code><a href="lxml.etree._Element-class.html#index">index</a></code>,
179 <code><a href="lxml.etree._Element-class.html#insert">insert</a></code>,
180 <code><a href="lxml.etree._Element-class.html#items">items</a></code>,
181 <code><a href="lxml.etree._Element-class.html#iter">iter</a></code>,
182 <code><a href="lxml.etree._Element-class.html#iterancestors">iterancestors</a></code>,
183 <code><a href="lxml.etree._Element-class.html#iterchildren">iterchildren</a></code>,
184 <code><a href="lxml.etree._Element-class.html#iterdescendants">iterdescendants</a></code>,
185 <code><a href="lxml.etree._Element-class.html#iterfind">iterfind</a></code>,
186 <code><a href="lxml.etree._Element-class.html#itersiblings">itersiblings</a></code>,
187 <code><a href="lxml.etree._Element-class.html#itertext">itertext</a></code>,
188 <code><a href="lxml.etree._Element-class.html#keys">keys</a></code>,
189 <code><a href="lxml.etree._Element-class.html#makeelement">makeelement</a></code>,
190 <code><a href="lxml.etree._Element-class.html#remove">remove</a></code>,
191 <code><a href="lxml.etree._Element-class.html#replace">replace</a></code>,
192 <code><a href="lxml.etree._Element-class.html#values">values</a></code>,
193 <code><a href="lxml.etree._Element-class.html#xpath">xpath</a></code>
195 <div class="private"> <p class="indent-wrapped-lines"><b>Inherited from <code><a href="lxml.etree._Element-class.html" onclick="show_private();">etree._Element</a></code></b> (private):
196 <code><a href="lxml.etree._Element-class.html#_init" onclick="show_private();">_init</a></code>
198 <p class="indent-wrapped-lines"><b>Inherited from <code><a href="lxml.html.HtmlMixin-class.html">HtmlMixin</a></code></b>:
199 <code><a href="lxml.html.HtmlMixin-class.html#drop_tag">drop_tag</a></code>,
200 <code><a href="lxml.html.HtmlMixin-class.html#drop_tree">drop_tree</a></code>,
201 <code><a href="lxml.html.HtmlMixin-class.html#find_class">find_class</a></code>,
202 <code><a href="lxml.html.HtmlMixin-class.html#find_rel_links">find_rel_links</a></code>,
203 <code><a href="lxml.html.HtmlMixin-class.html#get_element_by_id">get_element_by_id</a></code>,
204 <code><a href="lxml.html.HtmlMixin-class.html#iterlinks">iterlinks</a></code>,
205 <code><a href="lxml.html.HtmlMixin-class.html#make_links_absolute">make_links_absolute</a></code>,
206 <code><a href="lxml.html.HtmlMixin-class.html#resolve_base_href">resolve_base_href</a></code>,
207 <code><a href="lxml.html.HtmlMixin-class.html#rewrite_links">rewrite_links</a></code>,
208 <code><a href="lxml.html.HtmlMixin-class.html#text_content">text_content</a></code>
210 <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
211 <code>__delattr__</code>,
212 <code>__format__</code>,
213 <code>__getattribute__</code>,
214 <code>__hash__</code>,
215 <code>__reduce__</code>,
216 <code>__reduce_ex__</code>,
217 <code>__setattr__</code>,
218 <code>__sizeof__</code>,
219 <code>__str__</code>,
220 <code>__subclasshook__</code>
225 <!-- ==================== PROPERTIES ==================== -->
226 <a name="section-Properties"></a>
227 <table class="summary" border="1" cellpadding="3"
228 cellspacing="0" width="100%" bgcolor="white">
229 <tr bgcolor="#70b0f0" class="table-header">
230 <td colspan="2" class="table-header">
231 <table border="0" cellpadding="0" cellspacing="0" width="100%">
233 <td align="left"><span class="table-header">Properties</span></td>
234 <td align="right" valign="top"
235 ><span class="options">[<a href="#section-Properties"
236 class="privatelink" onclick="toggle_private();"
237 >hide private</a>]</span></td>
243 <td colspan="2" class="summary">
244 <p class="indent-wrapped-lines"><b>Inherited from <code><a href="lxml.etree._Element-class.html" onclick="show_private();">etree._Element</a></code></b>:
245 <code><a href="lxml.etree._Element-class.html#attrib">attrib</a></code>,
246 <code><a href="lxml.etree._Element-class.html#base">base</a></code>,
247 <code><a href="lxml.etree._Element-class.html#nsmap">nsmap</a></code>,
248 <code><a href="lxml.etree._Element-class.html#prefix">prefix</a></code>,
249 <code><a href="lxml.etree._Element-class.html#sourceline">sourceline</a></code>,
250 <code><a href="lxml.etree._Element-class.html#tag">tag</a></code>,
251 <code><a href="lxml.etree._Element-class.html#tail">tail</a></code>,
252 <code><a href="lxml.etree._Element-class.html#text">text</a></code>
254 <p class="indent-wrapped-lines"><b>Inherited from <code><a href="lxml.html.HtmlMixin-class.html">HtmlMixin</a></code></b>:
255 <code><a href="lxml.html.HtmlMixin-class.html#base_url">base_url</a></code>,
256 <code><a href="lxml.html.HtmlMixin-class.html#body">body</a></code>,
257 <code><a href="lxml.html.HtmlMixin-class.html#classes">classes</a></code>,
258 <code><a href="lxml.html.HtmlMixin-class.html#forms">forms</a></code>,
259 <code><a href="lxml.html.HtmlMixin-class.html#head">head</a></code>,
260 <code><a href="lxml.html.HtmlMixin-class.html#label">label</a></code>
262 <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
263 <code>__class__</code>
268 <!-- ==================== METHOD DETAILS ==================== -->
269 <a name="section-MethodDetails"></a>
270 <table class="details" border="1" cellpadding="3"
271 cellspacing="0" width="100%" bgcolor="white">
272 <tr bgcolor="#70b0f0" class="table-header">
273 <td colspan="2" class="table-header">
274 <table border="0" cellpadding="0" cellspacing="0" width="100%">
276 <td align="left"><span class="table-header">Method Details</span></td>
277 <td align="right" valign="top"
278 ><span class="options">[<a href="#section-MethodDetails"
279 class="privatelink" onclick="toggle_private();"
280 >hide private</a>]</span></td>
286 <a name="cssselect"></a>
288 <table class="details" border="1" cellpadding="3"
289 cellspacing="0" width="100%" bgcolor="white">
291 <table width="100%" cellpadding="0" cellspacing="0" border="0">
292 <tr valign="top"><td>
293 <h3 class="epydoc"><span class="sig"><span class="sig-name">cssselect</span>(<span class="sig-arg">self</span>,
294 <span class="sig-arg">expr</span>,
295 <span class="sig-arg">translator</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">html</code><code class="variable-quote">'</code></span>)</span>
297 </td><td align="right" valign="top"
298 ><span class="codelink"><a href="lxml.html-pysrc.html#HtmlElement.cssselect">source code</a></span>
302 <p>Run the CSS expression on this element and its children,
303 returning a list of the results.</p>
304 <p>Equivalent to lxml.cssselect.CSSSelect(expr, translator='html')(self)
305 -- note that pre-compiling the expression can provide a substantial
309 <a href="lxml.html.HtmlMixin-class.html#cssselect">HtmlMixin.cssselect</a>
316 <table class="details" border="1" cellpadding="3"
317 cellspacing="0" width="100%" bgcolor="white">
319 <table width="100%" cellpadding="0" cellspacing="0" border="0">
320 <tr valign="top"><td>
321 <h3 class="epydoc"><span class="sig"><span class="sig-name">set</span>(<span class="sig-arg">self</span>,
322 <span class="sig-arg">key</span>,
323 <span class="sig-arg">value</span>=<span class="sig-default">None</span>)</span>
325 </td><td align="right" valign="top"
326 ><span class="codelink"><a href="lxml.html-pysrc.html#HtmlElement.set">source code</a></span>
330 Sets an element attribute. If no value is provided, or if the value is None,
331 creates a 'boolean' attribute without value, e.g. "<form novalidate></form>"
332 for <tt class="rst-docutils literal"><span class="pre">form.set('novalidate')</span></tt>.
335 <a href="lxml.html.HtmlMixin-class.html#set">HtmlMixin.set</a>
341 <!-- ==================== NAVIGATION BAR ==================== -->
342 <table class="navbar" border="0" width="100%" cellpadding="0"
343 bgcolor="#a0c0ff" cellspacing="0">
346 <th> <a
347 href="lxml-module.html">Home</a> </th>
350 <th> <a
351 href="module-tree.html">Trees</a> </th>
354 <th> <a
355 href="identifier-index.html">Indices</a> </th>
358 <th> <a
359 href="help.html">Help</a> </th>
361 <!-- Project homepage -->
362 <th class="navbar" align="right" width="100%">
363 <table border="0" cellpadding="0" cellspacing="0">
364 <tr><th class="navbar" align="center"
365 ><a class="navbar" target="_top" href="/">lxml API</a></th>
369 <table border="0" cellpadding="0" cellspacing="0" width="100%%">
371 <td align="left" class="footer">
372 Generated by Epydoc 3.0.1
373 on Wed Jan 29 12:26:21 2020
375 <td align="right" class="footer">
376 <a target="mainFrame" href="http://epydoc.sourceforge.net"
377 >http://epydoc.sourceforge.net</a>
382 <script type="text/javascript">
384 // Private objects are initially displayed (because if
385 // javascript is turned off then we want them to be
386 // visible); but by default, we want to hide them. So hide
387 // them unless we have a cookie that says to show them.