Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / html / python / lib / module-xml.sax.xmlreader.html
CommitLineData
86530b38
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="next" href="module-xmllib.html" />
13<link rel="prev" href="module-xml.sax.saxutils.html" />
14<link rel="parent" href="markup.html" />
15<link rel="next" href="xmlreader-objects.html" />
16<meta name='aesop' content='information' />
17<title>13.12 xml.sax.xmlreader -- Interface for XML parsers</title>
18</head>
19<body>
20<DIV CLASS="navigation">
21<div id='top-navigation-panel' xml:id='top-navigation-panel'>
22<table align="center" width="100%" cellpadding="0" cellspacing="2">
23<tr>
24<td class='online-navigation'><a rel="prev" title="13.11 xml.sax.saxutils "
25 href="module-xml.sax.saxutils.html"><img src='../icons/previous.png'
26 border='0' height='32' alt='Previous Page' width='32' /></A></td>
27<td class='online-navigation'><a rel="parent" title="13. Structured Markup Processing"
28 href="markup.html"><img src='../icons/up.png'
29 border='0' height='32' alt='Up One Level' width='32' /></A></td>
30<td class='online-navigation'><a rel="next" title="13.12.1 XMLReader Objects"
31 href="xmlreader-objects.html"><img src='../icons/next.png'
32 border='0' height='32' alt='Next Page' width='32' /></A></td>
33<td align="center" width="100%">Python Library Reference</td>
34<td class='online-navigation'><a rel="contents" title="Table of Contents"
35 href="contents.html"><img src='../icons/contents.png'
36 border='0' height='32' alt='Contents' width='32' /></A></td>
37<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
38 border='0' height='32' alt='Module Index' width='32' /></a></td>
39<td class='online-navigation'><a rel="index" title="Index"
40 href="genindex.html"><img src='../icons/index.png'
41 border='0' height='32' alt='Index' width='32' /></A></td>
42</tr></table>
43<div class='online-navigation'>
44<b class="navlabel">Previous:</b>
45<a class="sectref" rel="prev" href="module-xml.sax.saxutils.html">13.11 xml.sax.saxutils </A>
46<b class="navlabel">Up:</b>
47<a class="sectref" rel="parent" href="markup.html">13. Structured Markup Processing</A>
48<b class="navlabel">Next:</b>
49<a class="sectref" rel="next" href="xmlreader-objects.html">13.12.1 XMLReader Objects</A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H1><A NAME="SECTION00151200000000000000000">
5613.12 <tt class="module">xml.sax.xmlreader</tt> --
57 Interface for XML parsers</A>
58</H1>
59
60<P>
61<A NAME="module-xml.sax.xmlreader"></A>
62
63<P>
64
65<span class="versionnote">New in version 2.0.</span>
66
67<P>
68SAX parsers implement the <tt class="class">XMLReader</tt> interface. They are
69implemented in a Python module, which must provide a function
70<tt class="function">create_parser()</tt>. This function is invoked by
71<tt class="function">xml.sax.make_parser()</tt> with no arguments to create a new
72parser object.
73
74<P>
75<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
76 <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-4516' xml:id='l2h-4516' class="class">XMLReader</tt></b>(</nobr></td>
77 <td><var></var>)</td></tr></table></dt>
78<dd>
79 Base class which can be inherited by SAX parsers.
80</dl>
81
82<P>
83<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
84 <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-4517' xml:id='l2h-4517' class="class">IncrementalParser</tt></b>(</nobr></td>
85 <td><var></var>)</td></tr></table></dt>
86<dd>
87 In some cases, it is desirable not to parse an input source at once,
88 but to feed chunks of the document as they get available. Note that
89 the reader will normally not read the entire file, but read it in
90 chunks as well; still <tt class="method">parse()</tt> won't return until the entire
91 document is processed. So these interfaces should be used if the
92 blocking behaviour of <tt class="method">parse()</tt> is not desirable.
93
94<P>
95When the parser is instantiated it is ready to begin accepting data
96 from the feed method immediately. After parsing has been finished
97 with a call to close the reset method must be called to make the
98 parser ready to accept new data, either from feed or using the parse
99 method.
100
101<P>
102Note that these methods must <em>not</em> be called during parsing,
103 that is, after parse has been called and before it returns.
104
105<P>
106By default, the class also implements the parse method of the
107 XMLReader interface using the feed, close and reset methods of the
108 IncrementalParser interface as a convenience to SAX 2.0 driver
109 writers.
110</dl>
111
112<P>
113<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
114 <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-4518' xml:id='l2h-4518' class="class">Locator</tt></b>(</nobr></td>
115 <td><var></var>)</td></tr></table></dt>
116<dd>
117 Interface for associating a SAX event with a document location. A
118 locator object will return valid results only during calls to
119 DocumentHandler methods; at any other time, the results are
120 unpredictable. If information is not available, methods may return
121 <code>None</code>.
122</dl>
123
124<P>
125<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
126 <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-4519' xml:id='l2h-4519' class="class">InputSource</tt></b>(</nobr></td>
127 <td><var></var><big>[</big><var>systemId</var><big>]</big><var></var>)</td></tr></table></dt>
128<dd>
129 Encapsulation of the information needed by the <tt class="class">XMLReader</tt> to
130 read entities.
131
132<P>
133This class may include information about the public identifier,
134 system identifier, byte stream (possibly with character encoding
135 information) and/or the character stream of an entity.
136
137<P>
138Applications will create objects of this class for use in the
139 <tt class="method">XMLReader.parse()</tt> method and for returning from
140 EntityResolver.resolveEntity.
141
142<P>
143An <tt class="class">InputSource</tt> belongs to the application, the
144 <tt class="class">XMLReader</tt> is not allowed to modify <tt class="class">InputSource</tt> objects
145 passed to it from the application, although it may make copies and
146 modify those.
147</dl>
148
149<P>
150<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
151 <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-4520' xml:id='l2h-4520' class="class">AttributesImpl</tt></b>(</nobr></td>
152 <td><var>attrs</var>)</td></tr></table></dt>
153<dd>
154 This is an implementation of the <a class="ulink" href="attributes-objects.html"
155 ><tt class="class">Attributes</tt>
156 interface</a> (see
157 section&nbsp;<A href="attributes-objects.html#attributes-objects">13.12.5</A>). This is a dictionary-like
158 object which represents the element attributes in a
159 <tt class="method">startElement()</tt> call. In addition to the most useful
160 dictionary operations, it supports a number of other methods as
161 described by the interface. Objects of this class should be
162 instantiated by readers; <var>attrs</var> must be a dictionary-like
163 object containing a mapping from attribute names to attribute
164 values.
165</dl>
166
167<P>
168<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
169 <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-4521' xml:id='l2h-4521' class="class">AttributesNSImpl</tt></b>(</nobr></td>
170 <td><var>attrs, qnames</var>)</td></tr></table></dt>
171<dd>
172 Namespace-aware variant of <tt class="class">AttributesImpl</tt>, which will be
173 passed to <tt class="method">startElementNS()</tt>. It is derived from
174 <tt class="class">AttributesImpl</tt>, but understands attribute names as
175 two-tuples of <var>namespaceURI</var> and <var>localname</var>. In addition,
176 it provides a number of methods expecting qualified names as they
177 appear in the original document. This class implements the
178 <a class="ulink" href="attributes-ns-objects.html"
179 ><tt class="class">AttributesNS</tt> interface</a>
180 (see section&nbsp;<A href="attributes-ns-objects.html#attributes-ns-objects">13.12.6</A>).
181</dl>
182
183<P>
184
185<p><br /></p><hr class='online-navigation' />
186<div class='online-navigation'>
187<!--Table of Child-Links-->
188<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a>
189
190<UL CLASS="ChildLinks">
191<LI><A href="xmlreader-objects.html">13.12.1 XMLReader Objects</a>
192<LI><A href="incremental-parser-objects.html">13.12.2 IncrementalParser Objects</a>
193<LI><A href="locator-objects.html">13.12.3 Locator Objects</a>
194<LI><A href="input-source-objects.html">13.12.4 InputSource Objects</a>
195<LI><A href="attributes-objects.html">13.12.5 The <tt class="class">Attributes</tt> Interface</a>
196<LI><A href="attributes-ns-objects.html">13.12.6 The <tt class="class">AttributesNS</tt> Interface</a>
197</ul>
198<!--End of Table of Child-Links-->
199</div>
200
201<DIV CLASS="navigation">
202<div class='online-navigation'>
203<p></p><hr />
204<table align="center" width="100%" cellpadding="0" cellspacing="2">
205<tr>
206<td class='online-navigation'><a rel="prev" title="13.11 xml.sax.saxutils "
207 href="module-xml.sax.saxutils.html"><img src='../icons/previous.png'
208 border='0' height='32' alt='Previous Page' width='32' /></A></td>
209<td class='online-navigation'><a rel="parent" title="13. Structured Markup Processing"
210 href="markup.html"><img src='../icons/up.png'
211 border='0' height='32' alt='Up One Level' width='32' /></A></td>
212<td class='online-navigation'><a rel="next" title="13.12.1 XMLReader Objects"
213 href="xmlreader-objects.html"><img src='../icons/next.png'
214 border='0' height='32' alt='Next Page' width='32' /></A></td>
215<td align="center" width="100%">Python Library Reference</td>
216<td class='online-navigation'><a rel="contents" title="Table of Contents"
217 href="contents.html"><img src='../icons/contents.png'
218 border='0' height='32' alt='Contents' width='32' /></A></td>
219<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
220 border='0' height='32' alt='Module Index' width='32' /></a></td>
221<td class='online-navigation'><a rel="index" title="Index"
222 href="genindex.html"><img src='../icons/index.png'
223 border='0' height='32' alt='Index' width='32' /></A></td>
224</tr></table>
225<div class='online-navigation'>
226<b class="navlabel">Previous:</b>
227<a class="sectref" rel="prev" href="module-xml.sax.saxutils.html">13.11 xml.sax.saxutils </A>
228<b class="navlabel">Up:</b>
229<a class="sectref" rel="parent" href="markup.html">13. Structured Markup Processing</A>
230<b class="navlabel">Next:</b>
231<a class="sectref" rel="next" href="xmlreader-objects.html">13.12.1 XMLReader Objects</A>
232</div>
233</div>
234<hr />
235<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
236</DIV>
237<!--End of Navigation Panel-->
238<ADDRESS>
239See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
240</ADDRESS>
241</BODY>
242</HTML>