Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / html / python / lib / html-parser-objects.html
CommitLineData
920dae64
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="lib.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="lib.html" title='Python Library Reference' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='index' href='genindex.html' title='Index' />
10<link rel='last' href='about.html' title='About this document...' />
11<link rel='help' href='about.html' title='About this document...' />
12<link rel="prev" href="module-htmllib.html" />
13<link rel="parent" href="module-htmllib.html" />
14<link rel="next" href="module-htmlentitydefs.html" />
15<meta name='aesop' content='information' />
16<title>13.3.1 HTMLParser Objects </title>
17</head>
18<body>
19<DIV CLASS="navigation">
20<div id='top-navigation-panel' xml:id='top-navigation-panel'>
21<table align="center" width="100%" cellpadding="0" cellspacing="2">
22<tr>
23<td class='online-navigation'><a rel="prev" title="13.3 htmllib "
24 href="module-htmllib.html"><img src='../icons/previous.png'
25 border='0' height='32' alt='Previous Page' width='32' /></A></td>
26<td class='online-navigation'><a rel="parent" title="13.3 htmllib "
27 href="module-htmllib.html"><img src='../icons/up.png'
28 border='0' height='32' alt='Up One Level' width='32' /></A></td>
29<td class='online-navigation'><a rel="next" title="13.4 htmlentitydefs "
30 href="module-htmlentitydefs.html"><img src='../icons/next.png'
31 border='0' height='32' alt='Next Page' width='32' /></A></td>
32<td align="center" width="100%">Python Library Reference</td>
33<td class='online-navigation'><a rel="contents" title="Table of Contents"
34 href="contents.html"><img src='../icons/contents.png'
35 border='0' height='32' alt='Contents' width='32' /></A></td>
36<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
37 border='0' height='32' alt='Module Index' width='32' /></a></td>
38<td class='online-navigation'><a rel="index" title="Index"
39 href="genindex.html"><img src='../icons/index.png'
40 border='0' height='32' alt='Index' width='32' /></A></td>
41</tr></table>
42<div class='online-navigation'>
43<b class="navlabel">Previous:</b>
44<a class="sectref" rel="prev" href="module-htmllib.html">13.3 htmllib </A>
45<b class="navlabel">Up:</b>
46<a class="sectref" rel="parent" href="module-htmllib.html">13.3 htmllib </A>
47<b class="navlabel">Next:</b>
48<a class="sectref" rel="next" href="module-htmlentitydefs.html">13.4 htmlentitydefs </A>
49</div>
50<hr /></div>
51</DIV>
52<!--End of Navigation Panel-->
53
54<H2><A NAME="SECTION0015310000000000000000"></A><A NAME="html-parser-objects"></A>
55<BR>
5613.3.1 HTMLParser Objects
57</H2>
58
59<P>
60In addition to tag methods, the <tt class="class">HTMLParser</tt> class provides some
61additional methods and instance variables for use within tag methods.
62
63<P>
64<dl><dt><b><tt id='l2h-4289' xml:id='l2h-4289' class="member">formatter</tt></b></dt>
65<dd>
66This is the formatter instance associated with the parser.
67</dl>
68
69<P>
70<dl><dt><b><tt id='l2h-4290' xml:id='l2h-4290' class="member">nofill</tt></b></dt>
71<dd>
72Boolean flag which should be true when whitespace should not be
73collapsed, or false when it should be. In general, this should only
74be true when character data is to be treated as ``preformatted'' text,
75as within a <code>&lt;PRE&gt;</code> element. The default value is false. This
76affects the operation of <tt class="method">handle_data()</tt> and <tt class="method">save_end()</tt>.
77</dl>
78
79<P>
80<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
81 <td><nobr><b><tt id='l2h-4291' xml:id='l2h-4291' class="method">anchor_bgn</tt></b>(</nobr></td>
82 <td><var>href, name, type</var>)</td></tr></table></dt>
83<dd>
84This method is called at the start of an anchor region. The arguments
85correspond to the attributes of the <code>&lt;A&gt;</code> tag with the same
86names. The default implementation maintains a list of hyperlinks
87(defined by the <code>HREF</code> attribute for <code>&lt;A&gt;</code> tags) within the
88document. The list of hyperlinks is available as the data attribute
89<tt class="member">anchorlist</tt>.
90</dl>
91
92<P>
93<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
94 <td><nobr><b><tt id='l2h-4292' xml:id='l2h-4292' class="method">anchor_end</tt></b>(</nobr></td>
95 <td><var></var>)</td></tr></table></dt>
96<dd>
97This method is called at the end of an anchor region. The default
98implementation adds a textual footnote marker using an index into the
99list of hyperlinks created by <tt class="method">anchor_bgn()</tt>.
100</dl>
101
102<P>
103<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
104 <td><nobr><b><tt id='l2h-4293' xml:id='l2h-4293' class="method">handle_image</tt></b>(</nobr></td>
105 <td><var>source, alt</var><big>[</big><var>, ismap</var><big>[</big><var>,
106 align</var><big>[</big><var>, width</var><big>[</big><var>, height</var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
107<dd>
108This method is called to handle images. The default implementation
109simply passes the <var>alt</var> value to the <tt class="method">handle_data()</tt>
110method.
111</dl>
112
113<P>
114<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
115 <td><nobr><b><tt id='l2h-4294' xml:id='l2h-4294' class="method">save_bgn</tt></b>(</nobr></td>
116 <td><var></var>)</td></tr></table></dt>
117<dd>
118Begins saving character data in a buffer instead of sending it to the
119formatter object. Retrieve the stored data via <tt class="method">save_end()</tt>.
120Use of the <tt class="method">save_bgn()</tt> / <tt class="method">save_end()</tt> pair may not be
121nested.
122</dl>
123
124<P>
125<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
126 <td><nobr><b><tt id='l2h-4295' xml:id='l2h-4295' class="method">save_end</tt></b>(</nobr></td>
127 <td><var></var>)</td></tr></table></dt>
128<dd>
129Ends buffering character data and returns all data saved since the
130preceding call to <tt class="method">save_bgn()</tt>. If the <tt class="member">nofill</tt> flag is
131false, whitespace is collapsed to single spaces. A call to this
132method without a preceding call to <tt class="method">save_bgn()</tt> will raise a
133<tt class="exception">TypeError</tt> exception.
134</dl>
135
136<P>
137
138<DIV CLASS="navigation">
139<div class='online-navigation'>
140<p></p><hr />
141<table align="center" width="100%" cellpadding="0" cellspacing="2">
142<tr>
143<td class='online-navigation'><a rel="prev" title="13.3 htmllib "
144 href="module-htmllib.html"><img src='../icons/previous.png'
145 border='0' height='32' alt='Previous Page' width='32' /></A></td>
146<td class='online-navigation'><a rel="parent" title="13.3 htmllib "
147 href="module-htmllib.html"><img src='../icons/up.png'
148 border='0' height='32' alt='Up One Level' width='32' /></A></td>
149<td class='online-navigation'><a rel="next" title="13.4 htmlentitydefs "
150 href="module-htmlentitydefs.html"><img src='../icons/next.png'
151 border='0' height='32' alt='Next Page' width='32' /></A></td>
152<td align="center" width="100%">Python Library Reference</td>
153<td class='online-navigation'><a rel="contents" title="Table of Contents"
154 href="contents.html"><img src='../icons/contents.png'
155 border='0' height='32' alt='Contents' width='32' /></A></td>
156<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
157 border='0' height='32' alt='Module Index' width='32' /></a></td>
158<td class='online-navigation'><a rel="index" title="Index"
159 href="genindex.html"><img src='../icons/index.png'
160 border='0' height='32' alt='Index' width='32' /></A></td>
161</tr></table>
162<div class='online-navigation'>
163<b class="navlabel">Previous:</b>
164<a class="sectref" rel="prev" href="module-htmllib.html">13.3 htmllib </A>
165<b class="navlabel">Up:</b>
166<a class="sectref" rel="parent" href="module-htmllib.html">13.3 htmllib </A>
167<b class="navlabel">Next:</b>
168<a class="sectref" rel="next" href="module-htmlentitydefs.html">13.4 htmlentitydefs </A>
169</div>
170</div>
171<hr />
172<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
173</DIV>
174<!--End of Navigation Panel-->
175<ADDRESS>
176See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
177</ADDRESS>
178</BODY>
179</HTML>