⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 module-xmlparsersexpat.html

📁 一本很好的python的说明书,适合对python感兴趣的人
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<P>
<dl><dt><b><a name='l2h-2601'><tt>ErrorByteIndex</tt></a></b>
<dd> 
Byte index at which an error occurred.
</dl> 

<P>
<dl><dt><b><a name='l2h-2602'><tt>ErrorCode</tt></a></b>
<dd> 
Numeric code specifying the problem.  This value can be passed to the
<tt class="function">ErrorString()</tt> function, or compared to one of the constants
defined in the <tt class="module">errors</tt> object.
</dl>

<P>
<dl><dt><b><a name='l2h-2603'><tt>ErrorColumnNumber</tt></a></b>
<dd> 
Column number at which an error occurred.
</dl>

<P>
<dl><dt><b><a name='l2h-2604'><tt>ErrorLineNumber</tt></a></b>
<dd>
Line number at which an error occurred.
</dl>

<P>
Here is the list of handlers that can be set.  To set a handler on an
<tt class="class">xmlparser</tt> object <var>o</var>, use
<code><var>o</var>.<var>handlername</var> = <var>func</var></code>.  <var>handlername</var> must
be taken from the following list, and <var>func</var> must be a callable
object accepting the correct number of arguments.  The arguments are
all strings, unless otherwise stated.

<P>
<dl><dt><b><a name='l2h-2605'><tt class='method'>StartElementHandler</tt></a></b> (<var>name, attributes</var>)
<dd>
Called for the start of every element.  <var>name</var> is a string
containing the element name, and <var>attributes</var> is a dictionary
mapping attribute names to their values.
</dl>

<P>
<dl><dt><b><a name='l2h-2606'><tt class='method'>EndElementHandler</tt></a></b> (<var>name</var>)
<dd>
Called for the end of every element.
</dl>

<P>
<dl><dt><b><a name='l2h-2607'><tt class='method'>ProcessingInstructionHandler</tt></a></b> (<var>target, data</var>)
<dd>
Called for every processing instruction.  
</dl>

<P>
<dl><dt><b><a name='l2h-2608'><tt class='method'>CharacterDataHandler</tt></a></b> (<var><var>data</var></var>)
<dd>
Called for character data.  
</dl>

<P>
<dl><dt><b><a name='l2h-2609'><tt class='method'>UnparsedEntityDeclHandler</tt></a></b> (<var>entityName, base,
                                              systemId, publicId,
                                              notationName</var>)
<dd>
Called for unparsed (NDATA) entity declarations.
</dl>

<P>
<dl><dt><b><a name='l2h-2610'><tt class='method'>NotationDeclHandler</tt></a></b> (<var>notationName, base, systemId,
                                        publicId</var>)
<dd>
Called for notation declarations.
</dl>

<P>
<dl><dt><b><a name='l2h-2611'><tt class='method'>StartNamespaceDeclHandler</tt></a></b> (<var>prefix, uri</var>)
<dd>
Called when an element contains a namespace declaration.
</dl>

<P>
<dl><dt><b><a name='l2h-2612'><tt class='method'>EndNamespaceDeclHandler</tt></a></b> (<var>prefix</var>)
<dd>
Called when the closing tag is reached for an element 
that contained a namespace declaration.
</dl>

<P>
<dl><dt><b><a name='l2h-2613'><tt class='method'>CommentHandler</tt></a></b> (<var>data</var>)
<dd>
Called for comments.
</dl>

<P>
<dl><dt><b><a name='l2h-2614'><tt class='method'>StartCdataSectionHandler</tt></a></b> ()
<dd>
Called at the start of a CDATA section.
</dl>

<P>
<dl><dt><b><a name='l2h-2615'><tt class='method'>EndCdataSectionHandler</tt></a></b> ()
<dd>
Called at the end of a CDATA section.
</dl>

<P>
<dl><dt><b><a name='l2h-2616'><tt class='method'>DefaultHandler</tt></a></b> (<var>data</var>)
<dd>
Called for any characters in the XML document for
which no applicable handler has been specified.  This means
characters that are part of a construct which could be reported, but
for which no handler has been supplied. 
</dl>

<P>
<dl><dt><b><a name='l2h-2617'><tt class='method'>DefaultHandlerExpand</tt></a></b> (<var>data</var>)
<dd>
This is the same as the <tt class="function">DefaultHandler</tt>, 
but doesn't inhibit expansion of internal entities.
The entity reference will not be passed to the default handler.
</dl>

<P>
<dl><dt><b><a name='l2h-2618'><tt class='method'>NotStandaloneHandler</tt></a></b> ()
<dd>
Called if the XML document hasn't been declared as being a standalone
document.
</dl>

<P>
<dl><dt><b><a name='l2h-2619'><tt class='method'>ExternalEntityRefHandler</tt></a></b> (<var>context, base, systemId,
                                             publicId</var>)
<dd>
Called for references to external entities.  
</dl>

<P>

<p><hr>
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>

<UL>
<LI><A NAME="tex2html4824"
  href="expat-example.html" tppabs="http://www.python.org/doc/current/lib/expat-example.html">13.4.1 Example </A>
<LI><A NAME="tex2html4825"
  href="expat-errors.html" tppabs="http://www.python.org/doc/current/lib/expat-errors.html">13.4.2 Expat error constants </A>
</UL>
<!--End of Table of Child-Links-->

<DIV CLASS="navigation"><p><hr><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="module-htmlentitydefs.html" tppabs="http://www.python.org/doc/current/lib/module-htmlentitydefs.html"><img src="previous.gif" tppabs="http://www.python.org/doc/current/icons/previous.gif" border="0" height="32"
  alt="Previous Page" width="32"></A></td>
<td><A href="markup.html" tppabs="http://www.python.org/doc/current/lib/markup.html"><img src="up.gif" tppabs="http://www.python.org/doc/current/icons/up.gif" border="0" height="32"
  alt="Up One Level" width="32"></A></td>
<td><A href="expat-example.html" tppabs="http://www.python.org/doc/current/lib/expat-example.html"><img src="next.gif" tppabs="http://www.python.org/doc/current/icons/next.gif" border="0" height="32"
  alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td><A href="contents.html" tppabs="http://www.python.org/doc/current/lib/contents.html"><img src="contents.gif" tppabs="http://www.python.org/doc/current/icons/contents.gif" border="0" height="32"
  alt="Contents" width="32"></A></td>
<td><a href="modindex.html" tppabs="http://www.python.org/doc/current/lib/modindex.html" title="Module Index"><img src="modules.gif" tppabs="http://www.python.org/doc/current/icons/modules.gif" border="0" height="32"
  alt="Module Index" width="32"></a></td>
<td><A href="genindex.html" tppabs="http://www.python.org/doc/current/lib/genindex.html"><img src="index.gif" tppabs="http://www.python.org/doc/current/icons/index.gif" border="0" height="32"
  alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="module-htmlentitydefs.html" tppabs="http://www.python.org/doc/current/lib/module-htmlentitydefs.html">13.3 htmlentitydefs  </A>
<b class="navlabel">Up:</b> <a class="sectref" href="markup.html" tppabs="http://www.python.org/doc/current/lib/markup.html">13. Structured Markup Processing</A>
<b class="navlabel">Next:</b> <a class="sectref" href="expat-example.html" tppabs="http://www.python.org/doc/current/lib/expat-example.html">13.4.1 Example</A>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
<hr>See <i><a href="about.html" tppabs="http://www.python.org/doc/current/lib/about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -