Commit c9bfdf88 authored by Fred Drake's avatar Fred Drake

Updated to reflect the additional information and interfaces exported in

pyexpat.c revision 2.40.
parent f035473a
...@@ -32,10 +32,14 @@ provide access to the Expat parser. Direct use of the ...@@ -32,10 +32,14 @@ provide access to the Expat parser. Direct use of the
This module provides one exception and one type object: This module provides one exception and one type object:
\begin{excdesc}{error} \begin{excdesc}{ExpatError}
The exception raised when Expat reports an error. The exception raised when Expat reports an error.
\end{excdesc} \end{excdesc}
\begin{excdesc}{error}
Alias for \exception{ExpatError}.
\end{excdesc}
\begin{datadesc}{XMLParserType} \begin{datadesc}{XMLParserType}
The type of the return values from the \function{ParserCreate()} The type of the return values from the \function{ParserCreate()}
function. function.
...@@ -126,6 +130,14 @@ Returns a string containing the base set by a previous call to ...@@ -126,6 +130,14 @@ Returns a string containing the base set by a previous call to
\method{SetBase()} hasn't been called. \method{SetBase()} hasn't been called.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[xmlparser]{GetInputContext}{}
Returns the input data that generated the current event as a string.
The data is in the encoding of the entity which contains the text.
When called while an event handler is not active, the return value is
\code{None}.
\versionadded{2.1}
\end{methoddesc}
\begin{methoddesc}[xmlparser]{ExternalEntityParserCreate}{context\optional{, \begin{methoddesc}[xmlparser]{ExternalEntityParserCreate}{context\optional{,
encoding}} encoding}}
Create a ``child'' parser which can be used to parse an external Create a ``child'' parser which can be used to parse an external
...@@ -385,6 +397,32 @@ If this handler is not provided, external entities are reported by the ...@@ -385,6 +397,32 @@ If this handler is not provided, external entities are reported by the
\end{methoddesc} \end{methoddesc}
\subsection{ExpatError Exceptions \label{expaterror-objects}}
\sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org}
\exception{ExpatError} exceptions have a number of interesting
attributes:
\begin{memberdesc}[ExpatError]{code}
Expat's internal error number for the specific error. This will
match one of the constants defined in the \code{errors} object from
this module.
\versionadded{2.1}
\end{memberdesc}
\begin{memberdesc}[ExpatError]{lineno}
Line number on which the error was detected. The first line is
numbered \code{1}.
\versionadded{2.1}
\end{memberdesc}
\begin{memberdesc}[ExpatError]{offset}
Character offset into the line where the error occurred. The first
column is numbered \code{0}.
\versionadded{2.1}
\end{memberdesc}
\subsection{Example \label{expat-example}} \subsection{Example \label{expat-example}}
The following program defines three handlers that just print out their The following program defines three handlers that just print out their
...@@ -493,10 +531,10 @@ The model must occur zero or more times, as for \code{A*}. ...@@ -493,10 +531,10 @@ The model must occur zero or more times, as for \code{A*}.
\subsection{Expat error constants \label{expat-errors}} \subsection{Expat error constants \label{expat-errors}}
\sectionauthor{A.M. Kuchling}{amk1@bigfoot.com} \sectionauthor{A.M. Kuchling}{amk1@bigfoot.com}
The following table lists the error constants in the The following constants are provided in the \code{errors} object of
\code{errors} object of the \module{xml.parsers.expat} module. These the \refmodule{xml.parsers.expat} module. These constants are useful
constants are useful in interpreting some of the attributes of the in interpreting some of the attributes of the \exception{ExpatError}
parser object after an error has occurred. exception objects raised when an error has occurred.
The \code{errors} object has the following attributes: The \code{errors} object has the following attributes:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment