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.etree.CustomElementClassLookup</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">
45 <a href="lxml-module.html">Package lxml</a> ::
46 <a href="lxml.etree-module.html">Module etree</a> ::
47 Class CustomElementClassLookup
51 <table cellpadding="0" cellspacing="0">
52 <!-- hide/show private -->
53 <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
54 onclick="toggle_private();">hide private</a>]</span></td></tr>
55 <tr><td align="right"><span class="options"
56 >[<a href="frames.html" target="_top">frames</a
57 >] | <a href="lxml.etree.CustomElementClassLookup-class.html"
58 target="_top">no frames</a>]</span></td></tr>
63 <!-- ==================== CLASS DESCRIPTION ==================== -->
64 <h1 class="epydoc">Class CustomElementClassLookup</h1><p class="nomargin-top"></p>
65 <pre class="base-tree">
68 <a href="lxml.etree.ElementClassLookup-class.html">ElementClassLookup</a> --+
70 <a href="lxml.etree.FallbackElementClassLookup-class.html">FallbackElementClassLookup</a> --+
72 <strong class="uidshort">CustomElementClassLookup</strong>
75 <dl><dt>Known Subclasses:</dt>
77 <ul class="subclass-list">
78 <li><a href="lxml.html.HtmlElementClassLookup-class.html">html.HtmlElementClassLookup</a></li> </ul>
82 <p>CustomElementClassLookup(self, fallback=None)
83 Element class lookup based on a subclass method.</p>
84 <p>You can inherit from this class and override the method:</p>
85 <pre class="rst-literal-block">
86 lookup(self, type, doc, namespace, name)
88 <p>to lookup the element class for a node. Arguments of the method:
89 * type: one of 'element', 'comment', 'PI', 'entity'
90 * doc: document that the node is in
91 * namespace: namespace URI of the node (or None for comments/PIs/entities)
92 * name: name of the element/entity, None for comments, target for PIs</p>
93 <p>If you return None from this method, the fallback will be called.</p>
95 <!-- ==================== INSTANCE METHODS ==================== -->
96 <a name="section-InstanceMethods"></a>
97 <table class="summary" border="1" cellpadding="3"
98 cellspacing="0" width="100%" bgcolor="white">
99 <tr bgcolor="#70b0f0" class="table-header">
100 <td colspan="2" class="table-header">
101 <table border="0" cellpadding="0" cellspacing="0" width="100%">
103 <td align="left"><span class="table-header">Instance Methods</span></td>
104 <td align="right" valign="top"
105 ><span class="options">[<a href="#section-InstanceMethods"
106 class="privatelink" onclick="toggle_private();"
107 >hide private</a>]</span></td>
113 <td width="15%" align="right" valign="top" class="summary">
114 <span class="summary-type">a new object with type S, a subtype of T</span>
115 </td><td class="summary">
116 <table width="100%" cellpadding="0" cellspacing="0" border="0">
118 <td><span class="summary-sig"><a href="lxml.etree.CustomElementClassLookup-class.html#__new__" class="summary-sig-name">__new__</a>(<span class="summary-sig-arg">T</span>,
119 <span class="summary-sig-arg">S</span>,
120 <span class="summary-sig-arg">...</span>)</span></td>
121 <td align="right" valign="top">
131 <td width="15%" align="right" valign="top" class="summary">
132 <span class="summary-type"> </span>
133 </td><td class="summary">
134 <table width="100%" cellpadding="0" cellspacing="0" border="0">
136 <td><span class="summary-sig"><a name="lookup"></a><span class="summary-sig-name">lookup</span>(<span class="summary-sig-arg">self</span>,
137 <span class="summary-sig-arg">type</span>,
138 <span class="summary-sig-arg">doc</span>,
139 <span class="summary-sig-arg">namespace</span>,
140 <span class="summary-sig-arg">name</span>)</span></td>
141 <td align="right" valign="top">
151 <td colspan="2" class="summary">
152 <p class="indent-wrapped-lines"><b>Inherited from <code><a href="lxml.etree.FallbackElementClassLookup-class.html">FallbackElementClassLookup</a></code></b>:
153 <code><a href="lxml.etree.FallbackElementClassLookup-class.html#__init__">__init__</a></code>,
154 <code><a href="lxml.etree.FallbackElementClassLookup-class.html#set_fallback">set_fallback</a></code>
156 <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
157 <code>__delattr__</code>,
158 <code>__format__</code>,
159 <code>__getattribute__</code>,
160 <code>__hash__</code>,
161 <code>__reduce__</code>,
162 <code>__reduce_ex__</code>,
163 <code>__repr__</code>,
164 <code>__setattr__</code>,
165 <code>__sizeof__</code>,
166 <code>__str__</code>,
167 <code>__subclasshook__</code>
172 <!-- ==================== PROPERTIES ==================== -->
173 <a name="section-Properties"></a>
174 <table class="summary" border="1" cellpadding="3"
175 cellspacing="0" width="100%" bgcolor="white">
176 <tr bgcolor="#70b0f0" class="table-header">
177 <td colspan="2" class="table-header">
178 <table border="0" cellpadding="0" cellspacing="0" width="100%">
180 <td align="left"><span class="table-header">Properties</span></td>
181 <td align="right" valign="top"
182 ><span class="options">[<a href="#section-Properties"
183 class="privatelink" onclick="toggle_private();"
184 >hide private</a>]</span></td>
190 <td colspan="2" class="summary">
191 <p class="indent-wrapped-lines"><b>Inherited from <code><a href="lxml.etree.FallbackElementClassLookup-class.html">FallbackElementClassLookup</a></code></b>:
192 <code><a href="lxml.etree.FallbackElementClassLookup-class.html#fallback">fallback</a></code>
194 <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
195 <code>__class__</code>
200 <!-- ==================== METHOD DETAILS ==================== -->
201 <a name="section-MethodDetails"></a>
202 <table class="details" border="1" cellpadding="3"
203 cellspacing="0" width="100%" bgcolor="white">
204 <tr bgcolor="#70b0f0" class="table-header">
205 <td colspan="2" class="table-header">
206 <table border="0" cellpadding="0" cellspacing="0" width="100%">
208 <td align="left"><span class="table-header">Method Details</span></td>
209 <td align="right" valign="top"
210 ><span class="options">[<a href="#section-MethodDetails"
211 class="privatelink" onclick="toggle_private();"
212 >hide private</a>]</span></td>
218 <a name="__new__"></a>
220 <table class="details" border="1" cellpadding="3"
221 cellspacing="0" width="100%" bgcolor="white">
223 <table width="100%" cellpadding="0" cellspacing="0" border="0">
224 <tr valign="top"><td>
225 <h3 class="epydoc"><span class="sig"><span class="sig-name">__new__</span>(<span class="sig-arg">T</span>,
226 <span class="sig-arg">S</span>,
227 <span class="sig-arg">...</span>)</span>
229 </td><td align="right" valign="top"
236 <dt>Returns: a new object with type S, a subtype of T</dt>
244 <!-- ==================== NAVIGATION BAR ==================== -->
245 <table class="navbar" border="0" width="100%" cellpadding="0"
246 bgcolor="#a0c0ff" cellspacing="0">
249 <th> <a
250 href="lxml-module.html">Home</a> </th>
253 <th> <a
254 href="module-tree.html">Trees</a> </th>
257 <th> <a
258 href="identifier-index.html">Indices</a> </th>
261 <th> <a
262 href="help.html">Help</a> </th>
264 <!-- Project homepage -->
265 <th class="navbar" align="right" width="100%">
266 <table border="0" cellpadding="0" cellspacing="0">
267 <tr><th class="navbar" align="center"
268 ><a class="navbar" target="_top" href="/">lxml API</a></th>
272 <table border="0" cellpadding="0" cellspacing="0" width="100%%">
274 <td align="left" class="footer">
275 Generated by Epydoc 3.0.1
276 on Thu Jul 9 18:29:53 2020
278 <td align="right" class="footer">
279 <a target="mainFrame" href="http://epydoc.sourceforge.net"
280 >http://epydoc.sourceforge.net</a>
285 <script type="text/javascript">
287 // Private objects are initially displayed (because if
288 // javascript is turned off then we want them to be
289 // visible); but by default, we want to hide them. So hide
290 // them unless we have a cookie that says to show them.