Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c5e2792

Browse files
committed
Talk about interfaces rather than implementation classes where appropriate.
Add hyperlinks to make the documentation on the Attributes and AttributesNS interfaces more discoverable. Closes SF bug #484603.
1 parent b6aa9cb commit c5e2792

2 files changed

Lines changed: 60 additions & 42 deletions

File tree

Doc/lib/xmlsaxhandler.tex

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -193,35 +193,38 @@ \subsection{ContentHandler Objects \label{content-handler-objects}}
193193

194194
There are cases, however, when applications need to use prefixes in
195195
character data or in attribute values, where they cannot safely be
196-
expanded automatically; the start/endPrefixMapping event supplies
197-
the information to the application to expand prefixes in those
198-
contexts itself, if necessary.
196+
expanded automatically; the \method{startPrefixMapping()} and
197+
\method{endPrefixMapping()} events supply the information to the
198+
application to expand prefixes in those contexts itself, if
199+
necessary.
199200

200-
Note that start/endPrefixMapping events are not guaranteed to be
201-
properly nested relative to each-other: all
202-
\method{startPrefixMapping()} events will occur before the
203-
corresponding \method{startElement()} event, and all
204-
\method{endPrefixMapping()} events will occur after the
205-
corresponding \method{endElement()} event, but their order is not
206-
guaranteed.
201+
Note that \method{startPrefixMapping()} and
202+
\method{endPrefixMapping()} events are not guaranteed to be properly
203+
nested relative to each-other: all \method{startPrefixMapping()}
204+
events will occur before the corresponding \method{startElement()}
205+
event, and all \method{endPrefixMapping()} events will occur after
206+
the corresponding \method{endElement()} event, but their order is
207+
not guaranteed.
207208
\end{methoddesc}
208209

209210
\begin{methoddesc}[ContentHandler]{endPrefixMapping}{prefix}
210211
End the scope of a prefix-URI mapping.
211-
212-
See \method{startPrefixMapping()} for details. This event will always
213-
occur after the corresponding endElement event, but the order of
214-
endPrefixMapping events is not otherwise guaranteed.
212+
213+
See \method{startPrefixMapping()} for details. This event will
214+
always occur after the corresponding \method{endElement()} event,
215+
but the order of \method{endPrefixMapping()} events is not otherwise
216+
guaranteed.
215217
\end{methoddesc}
216218

217219
\begin{methoddesc}[ContentHandler]{startElement}{name, attrs}
218220
Signals the start of an element in non-namespace mode.
219221

220222
The \var{name} parameter contains the raw XML 1.0 name of the
221223
element type as a string and the \var{attrs} parameter holds an
222-
instance of the \class{Attributes} class containing the attributes
223-
of the element. The object passed as \var{attrs} may be re-used by
224-
the parser; holding on to a reference to it is not a reliable way to
224+
object of the \ulink{\class{Attributes}
225+
interface}{attributes-objects.html} containing the attributes of the
226+
element. The object passed as \var{attrs} may be re-used by the
227+
parser; holding on to a reference to it is not a reliable way to
225228
keep a copy of the attributes. To keep a copy of the attributes,
226229
use the \method{copy()} method of the \var{attrs} object.
227230
\end{methoddesc}
@@ -230,7 +233,7 @@ \subsection{ContentHandler Objects \label{content-handler-objects}}
230233
Signals the end of an element in non-namespace mode.
231234

232235
The \var{name} parameter contains the name of the element type, just
233-
as with the startElement event.
236+
as with the \method{startElement()} event.
234237
\end{methoddesc}
235238

236239
\begin{methoddesc}[ContentHandler]{startElementNS}{name, qname, attrs}
@@ -239,8 +242,9 @@ \subsection{ContentHandler Objects \label{content-handler-objects}}
239242
The \var{name} parameter contains the name of the element type as a
240243
\code{(\var{uri}, \var{localname})} tuple, the \var{qname} parameter
241244
contains the raw XML 1.0 name used in the source document, and the
242-
\var{attrs} parameter holds an instance of the \class{AttributesNS}
243-
class containing the attributes of the element. If no namespace is
245+
\var{attrs} parameter holds an instance of the
246+
\ulink{\class{AttributesNS} interface}{attributes-ns-objects.html}
247+
containing the attributes of the element. If no namespace is
244248
associated with the element, the \var{uri} component of \var{name}
245249
will be \code{None}. The object passed as \var{attrs} may be
246250
re-used by the parser; holding on to a reference to it is not a

Doc/lib/xmlsaxreader.tex

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,27 @@ \section{\module{xml.sax.xmlreader} ---
6969
\end{classdesc}
7070

7171
\begin{classdesc}{AttributesImpl}{attrs}
72-
This is a dictionary-like object which represents the element
73-
attributes in a \method{startElement()} call. In addition to the
74-
most useful dictionary operations, it supports a number of other
75-
methods as described below. Objects of this class should be
72+
This is an implementation of the \ulink{\class{Attributes}
73+
interface}{attributes-objects.html} (see
74+
section~\ref{attributes-objects}). This is a dictionary-like
75+
object which represents the element attributes in a
76+
\method{startElement()} call. In addition to the most useful
77+
dictionary operations, it supports a number of other methods as
78+
described by the interface. Objects of this class should be
7679
instantiated by readers; \var{attrs} must be a dictionary-like
77-
object.
80+
object containing a mapping from attribute names to attribute
81+
values.
7882
\end{classdesc}
7983

8084
\begin{classdesc}{AttributesNSImpl}{attrs, qnames}
81-
Namespace-aware variant of attributes, which will be passed to
82-
\method{startElementNS()}. It is derived from \class{AttributesImpl},
83-
but understands attribute names as two-tuples of \var{namespaceURI}
84-
and \var{localname}. In addition, it provides a number of methods
85-
expecting qualified names as they appear in the original document.
85+
Namespace-aware variant of \class{AttributesImpl}, which will be
86+
passed to \method{startElementNS()}. It is derived from
87+
\class{AttributesImpl}, but understands attribute names as
88+
two-tuples of \var{namespaceURI} and \var{localname}. In addition,
89+
it provides a number of methods expecting qualified names as they
90+
appear in the original document. This class implements the
91+
\ulink{\class{AttributesNS} interface}{attributes-ns-objects.html}
92+
(see section~\ref{attributes-ns-objects}).
8693
\end{classdesc}
8794

8895

@@ -288,50 +295,57 @@ \subsection{InputSource Objects \label{input-source-objects}}
288295
\end{methoddesc}
289296

290297

291-
\subsection{AttributesImpl Objects \label{attributes-impl-objects}}
298+
\subsection{The \class{Attributes} Interface \label{attributes-objects}}
292299

293-
\class{AttributesImpl} objects implement a portion of the mapping
294-
protocol, and the methods \method{copy()}, \method{get()},
300+
\class{Attributes} objects implement a portion of the mapping
301+
protocol, including the methods \method{copy()}, \method{get()},
295302
\method{has_key()}, \method{items()}, \method{keys()}, and
296303
\method{values()}. The following methods are also provided:
297304

298-
\begin{methoddesc}[AttributesImpl]{getLength}{}
305+
\begin{methoddesc}[Attributes]{getLength}{}
299306
Return the number of attributes.
300307
\end{methoddesc}
301308

302-
\begin{methoddesc}[AttributesImpl]{getNames}{}
309+
\begin{methoddesc}[Attributes]{getNames}{}
303310
Return the names of the attributes.
304311
\end{methoddesc}
305312

306-
\begin{methoddesc}[AttributesImpl]{getType}{name}
313+
\begin{methoddesc}[Attributes]{getType}{name}
307314
Returns the type of the attribute \var{name}, which is normally
308315
\code{'CDATA'}.
309316
\end{methoddesc}
310317

311-
\begin{methoddesc}[AttributesImpl]{getValue}{name}
318+
\begin{methoddesc}[Attributes]{getValue}{name}
312319
Return the value of attribute \var{name}.
313320
\end{methoddesc}
314321

315322
% getValueByQName, getNameByQName, getQNameByName, getQNames available
316323
% here already, but documented only for derived class.
317324

318325

319-
\subsection{AttributesNSImpl Objects \label{attributes-ns-impl-objects}}
326+
\subsection{The \class{AttributesNS} Interface \label{attributes-ns-objects}}
320327

321-
\begin{methoddesc}[AttributesNSImpl]{getValueByQName}{name}
328+
This interface is a subtype of the \ulink{\class{Attributes}
329+
interface}{attributes-objects.html} (see
330+
section~\ref{attributes-objects}). All methods supported by that
331+
interface are also available on \class{AttributesNS} objects.
332+
333+
The following methods are also available:
334+
335+
\begin{methoddesc}[AttributesNS]{getValueByQName}{name}
322336
Return the value for a qualified name.
323337
\end{methoddesc}
324338

325-
\begin{methoddesc}[AttributesNSImpl]{getNameByQName}{name}
339+
\begin{methoddesc}[AttributesNS]{getNameByQName}{name}
326340
Return the \code{(\var{namespace}, \var{localname})} pair for a
327341
qualified \var{name}.
328342
\end{methoddesc}
329343

330-
\begin{methoddesc}[AttributesNSImpl]{getQNameByName}{name}
344+
\begin{methoddesc}[AttributesNS]{getQNameByName}{name}
331345
Return the qualified name for a \code{(\var{namespace},
332346
\var{localname})} pair.
333347
\end{methoddesc}
334348

335-
\begin{methoddesc}[AttributesNSImpl]{getQNames}{}
349+
\begin{methoddesc}[AttributesNS]{getQNames}{}
336350
Return the qualified names of all attributes.
337351
\end{methoddesc}

0 commit comments

Comments
 (0)