annotate Doc/lib/xmlsaxreader.tex @ 25838:8540887bcec6 2.2

Backport of 2.183: Fix memory leak in add_subclass() found by NealN with valgrind.
author Guido van Rossum <guido@python.org>
date Fri, 18 Oct 2002 13:42:21 +0000
parents b771857ed788
children 462a4c3118bb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15183
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
1 \section{\module{xml.sax.xmlreader} ---
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
2 Interface for XML parsers}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
3
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
4 \declaremodule{standard}{xml.sax.xmlreader}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
5 \modulesynopsis{Interface which SAX-compliant XML parsers must implement.}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
6 \sectionauthor{Martin v. L\"owis}{loewis@informatik.hu-berlin.de}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
7 \moduleauthor{Lars Marius Garshol}{larsga@garshol.priv.no}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
8
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
9 \versionadded{2.0}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
10
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
11
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
12 SAX parsers implement the \class{XMLReader} interface. They are
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
13 implemented in a Python module, which must provide a function
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
14 \function{create_parser()}. This function is invoked by
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
15 \function{xml.sax.make_parser()} with no arguments to create a new
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
16 parser object.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
17
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
18 \begin{classdesc}{XMLReader}{}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
19 Base class which can be inherited by SAX parsers.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
20 \end{classdesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
21
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
22 \begin{classdesc}{IncrementalParser}{}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
23 In some cases, it is desirable not to parse an input source at once,
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
24 but to feed chunks of the document as they get available. Note that
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
25 the reader will normally not read the entire file, but read it in
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
26 chunks as well; still \method{parse()} won't return until the entire
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
27 document is processed. So these interfaces should be used if the
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
28 blocking behaviour of \method{parse()} is not desirable.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
29
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
30 When the parser is instantiated it is ready to begin accepting data
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
31 from the feed method immediately. After parsing has been finished
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
32 with a call to close the reset method must be called to make the
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
33 parser ready to accept new data, either from feed or using the parse
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
34 method.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
35
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
36 Note that these methods must \emph{not} be called during parsing,
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
37 that is, after parse has been called and before it returns.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
38
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
39 By default, the class also implements the parse method of the
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
40 XMLReader interface using the feed, close and reset methods of the
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
41 IncrementalParser interface as a convenience to SAX 2.0 driver
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
42 writers.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
43 \end{classdesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
44
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
45 \begin{classdesc}{Locator}{}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
46 Interface for associating a SAX event with a document location. A
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
47 locator object will return valid results only during calls to
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
48 DocumentHandler methods; at any other time, the results are
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
49 unpredictable. If information is not available, methods may return
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
50 \code{None}.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
51 \end{classdesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
52
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
53 \begin{classdesc}{InputSource}{\optional{systemId}}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
54 Encapsulation of the information needed by the \class{XMLReader} to
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
55 read entities.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
56
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
57 This class may include information about the public identifier,
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
58 system identifier, byte stream (possibly with character encoding
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
59 information) and/or the character stream of an entity.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
60
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
61 Applications will create objects of this class for use in the
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
62 \method{XMLReader.parse()} method and for returning from
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
63 EntityResolver.resolveEntity.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
64
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
65 An \class{InputSource} belongs to the application, the
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
66 \class{XMLReader} is not allowed to modify \class{InputSource} objects
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
67 passed to it from the application, although it may make copies and
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
68 modify those.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
69 \end{classdesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
70
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
71 \begin{classdesc}{AttributesImpl}{attrs}
23990
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
72 This is an implementation of the \ulink{\class{Attributes}
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
73 interface}{attributes-objects.html} (see
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
74 section~\ref{attributes-objects}). This is a dictionary-like
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
75 object which represents the element attributes in a
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
76 \method{startElement()} call. In addition to the most useful
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
77 dictionary operations, it supports a number of other methods as
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
78 described by the interface. Objects of this class should be
15183
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
79 instantiated by readers; \var{attrs} must be a dictionary-like
23990
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
80 object containing a mapping from attribute names to attribute
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
81 values.
15183
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
82 \end{classdesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
83
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
84 \begin{classdesc}{AttributesNSImpl}{attrs, qnames}
23990
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
85 Namespace-aware variant of \class{AttributesImpl}, which will be
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
86 passed to \method{startElementNS()}. It is derived from
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
87 \class{AttributesImpl}, but understands attribute names as
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
88 two-tuples of \var{namespaceURI} and \var{localname}. In addition,
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
89 it provides a number of methods expecting qualified names as they
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
90 appear in the original document. This class implements the
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
91 \ulink{\class{AttributesNS} interface}{attributes-ns-objects.html}
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
92 (see section~\ref{attributes-ns-objects}).
15183
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
93 \end{classdesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
94
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
95
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
96 \subsection{XMLReader Objects \label{xmlreader-objects}}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
97
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
98 The \class{XMLReader} interface supports the following methods:
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
99
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
100 \begin{methoddesc}[XMLReader]{parse}{source}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
101 Process an input source, producing SAX events. The \var{source}
18416
33b4357aebb8 Fix up a few style nits -- avoid "e.g." and "i.e." -- these make
Fred Drake <fdrake@acm.org>
parents: 15183
diff changeset
102 object can be a system identifier (a string identifying the
15183
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
103 input source -- typically a file name or an URL), a file-like
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
104 object, or an \class{InputSource} object. When \method{parse()}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
105 returns, the input is completely processed, and the parser object
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
106 can be discarded or reset. As a limitation, the current implementation
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
107 only accepts byte streams; processing of character streams is for
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
108 further study.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
109 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
110
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
111 \begin{methoddesc}[XMLReader]{getContentHandler}{}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
112 Return the current \class{ContentHandler}.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
113 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
114
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
115 \begin{methoddesc}[XMLReader]{setContentHandler}{handler}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
116 Set the current \class{ContentHandler}. If no
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
117 \class{ContentHandler} is set, content events will be discarded.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
118 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
119
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
120 \begin{methoddesc}[XMLReader]{getDTDHandler}{}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
121 Return the current \class{DTDHandler}.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
122 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
123
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
124 \begin{methoddesc}[XMLReader]{setDTDHandler}{handler}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
125 Set the current \class{DTDHandler}. If no \class{DTDHandler} is
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
126 set, DTD events will be discarded.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
127 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
128
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
129 \begin{methoddesc}[XMLReader]{getEntityResolver}{}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
130 Return the current \class{EntityResolver}.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
131 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
132
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
133 \begin{methoddesc}[XMLReader]{setEntityResolver}{handler}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
134 Set the current \class{EntityResolver}. If no
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
135 \class{EntityResolver} is set, attempts to resolve an external
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
136 entity will result in opening the system identifier for the entity,
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
137 and fail if it is not available.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
138 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
139
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
140 \begin{methoddesc}[XMLReader]{getErrorHandler}{}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
141 Return the current \class{ErrorHandler}.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
142 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
143
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
144 \begin{methoddesc}[XMLReader]{setErrorHandler}{handler}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
145 Set the current error handler. If no \class{ErrorHandler} is set,
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
146 errors will be raised as exceptions, and warnings will be printed.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
147 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
148
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
149 \begin{methoddesc}[XMLReader]{setLocale}{locale}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
150 Allow an application to set the locale for errors and warnings.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
151
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
152 SAX parsers are not required to provide localization for errors and
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
153 warnings; if they cannot support the requested locale, however, they
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
154 must throw a SAX exception. Applications may request a locale change
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
155 in the middle of a parse.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
156 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
157
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
158 \begin{methoddesc}[XMLReader]{getFeature}{featurename}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
159 Return the current setting for feature \var{featurename}. If the
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
160 feature is not recognized, \exception{SAXNotRecognizedException} is
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
161 raised. The well-known featurenames are listed in the module
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
162 \module{xml.sax.handler}.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
163 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
164
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
165 \begin{methoddesc}[XMLReader]{setFeature}{featurename, value}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
166 Set the \var{featurename} to \var{value}. If the feature is not
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
167 recognized, \exception{SAXNotRecognizedException} is raised. If the
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
168 feature or its setting is not supported by the parser,
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
169 \var{SAXNotSupportedException} is raised.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
170 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
171
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
172 \begin{methoddesc}[XMLReader]{getProperty}{propertyname}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
173 Return the current setting for property \var{propertyname}. If the
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
174 property is not recognized, a \exception{SAXNotRecognizedException}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
175 is raised. The well-known propertynames are listed in the module
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
176 \module{xml.sax.handler}.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
177 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
178
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
179 \begin{methoddesc}[XMLReader]{setProperty}{propertyname, value}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
180 Set the \var{propertyname} to \var{value}. If the property is not
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
181 recognized, \exception{SAXNotRecognizedException} is raised. If the
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
182 property or its setting is not supported by the parser,
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
183 \var{SAXNotSupportedException} is raised.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
184 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
185
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
186
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
187 \subsection{IncrementalParser Objects
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
188 \label{incremental-parser-objects}}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
189
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
190 Instances of \class{IncrementalParser} offer the following additional
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
191 methods:
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
192
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
193 \begin{methoddesc}[IncrementalParser]{feed}{data}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
194 Process a chunk of \var{data}.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
195 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
196
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
197 \begin{methoddesc}[IncrementalParser]{close}{}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
198 Assume the end of the document. That will check well-formedness
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
199 conditions that can be checked only at the end, invoke handlers, and
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
200 may clean up resources allocated during parsing.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
201 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
202
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
203 \begin{methoddesc}[IncrementalParser]{reset}{}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
204 This method is called after close has been called to reset the
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
205 parser so that it is ready to parse new documents. The results of
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
206 calling parse or feed after close without calling reset are
20905
b0a6dbc90047 Remove stray quotes; probably left over from conversion from docstrings.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
207 undefined.
15183
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
208 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
209
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
210
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
211 \subsection{Locator Objects \label{locator-objects}}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
212
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
213 Instances of \class{Locator} provide these methods:
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
214
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
215 \begin{methoddesc}[Locator]{getColumnNumber}{}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
216 Return the column number where the current event ends.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
217 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
218
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
219 \begin{methoddesc}[Locator]{getLineNumber}{}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
220 Return the line number where the current event ends.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
221 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
222
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
223 \begin{methoddesc}[Locator]{getPublicId}{}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
224 Return the public identifier for the current event.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
225 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
226
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
227 \begin{methoddesc}[Locator]{getSystemId}{}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
228 Return the system identifier for the current event.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
229 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
230
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
231
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
232 \subsection{InputSource Objects \label{input-source-objects}}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
233
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
234 \begin{methoddesc}[InputSource]{setPublicId}{id}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
235 Sets the public identifier of this \class{InputSource}.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
236 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
237
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
238 \begin{methoddesc}[InputSource]{getPublicId}{}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
239 Returns the public identifier of this \class{InputSource}.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
240 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
241
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
242 \begin{methoddesc}[InputSource]{setSystemId}{id}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
243 Sets the system identifier of this \class{InputSource}.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
244 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
245
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
246 \begin{methoddesc}[InputSource]{getSystemId}{}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
247 Returns the system identifier of this \class{InputSource}.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
248 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
249
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
250 \begin{methoddesc}[InputSource]{setEncoding}{encoding}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
251 Sets the character encoding of this \class{InputSource}.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
252
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
253 The encoding must be a string acceptable for an XML encoding
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
254 declaration (see section 4.3.3 of the XML recommendation).
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
255
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
256 The encoding attribute of the \class{InputSource} is ignored if the
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
257 \class{InputSource} also contains a character stream.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
258 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
259
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
260 \begin{methoddesc}[InputSource]{getEncoding}{}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
261 Get the character encoding of this InputSource.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
262 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
263
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
264 \begin{methoddesc}[InputSource]{setByteStream}{bytefile}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
265 Set the byte stream (a Python file-like object which does not
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
266 perform byte-to-character conversion) for this input source.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
267
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
268 The SAX parser will ignore this if there is also a character stream
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
269 specified, but it will use a byte stream in preference to opening a
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
270 URI connection itself.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
271
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
272 If the application knows the character encoding of the byte stream,
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
273 it should set it with the setEncoding method.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
274 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
275
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
276 \begin{methoddesc}[InputSource]{getByteStream}{}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
277 Get the byte stream for this input source.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
278
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
279 The getEncoding method will return the character encoding for this
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
280 byte stream, or None if unknown.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
281 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
282
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
283 \begin{methoddesc}[InputSource]{setCharacterStream}{charfile}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
284 Set the character stream for this input source. (The stream must be
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
285 a Python 1.6 Unicode-wrapped file-like that performs conversion to
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
286 Unicode strings.)
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
287
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
288 If there is a character stream specified, the SAX parser will ignore
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
289 any byte stream and will not attempt to open a URI connection to the
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
290 system identifier.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
291 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
292
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
293 \begin{methoddesc}[InputSource]{getCharacterStream}{}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
294 Get the character stream for this input source.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
295 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
296
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
297
23990
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
298 \subsection{The \class{Attributes} Interface \label{attributes-objects}}
15183
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
299
23990
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
300 \class{Attributes} objects implement a portion of the mapping
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
301 protocol, including the methods \method{copy()}, \method{get()},
15183
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
302 \method{has_key()}, \method{items()}, \method{keys()}, and
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
303 \method{values()}. The following methods are also provided:
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
304
23990
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
305 \begin{methoddesc}[Attributes]{getLength}{}
15183
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
306 Return the number of attributes.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
307 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
308
23990
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
309 \begin{methoddesc}[Attributes]{getNames}{}
15183
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
310 Return the names of the attributes.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
311 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
312
23990
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
313 \begin{methoddesc}[Attributes]{getType}{name}
15183
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
314 Returns the type of the attribute \var{name}, which is normally
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
315 \code{'CDATA'}.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
316 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
317
23990
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
318 \begin{methoddesc}[Attributes]{getValue}{name}
15183
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
319 Return the value of attribute \var{name}.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
320 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
321
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
322 % getValueByQName, getNameByQName, getQNameByName, getQNames available
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
323 % here already, but documented only for derived class.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
324
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
325
23990
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
326 \subsection{The \class{AttributesNS} Interface \label{attributes-ns-objects}}
15183
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
327
23990
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
328 This interface is a subtype of the \ulink{\class{Attributes}
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
329 interface}{attributes-objects.html} (see
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
330 section~\ref{attributes-objects}). All methods supported by that
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
331 interface are also available on \class{AttributesNS} objects.
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
332
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
333 The following methods are also available:
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
334
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
335 \begin{methoddesc}[AttributesNS]{getValueByQName}{name}
15183
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
336 Return the value for a qualified name.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
337 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
338
23990
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
339 \begin{methoddesc}[AttributesNS]{getNameByQName}{name}
15183
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
340 Return the \code{(\var{namespace}, \var{localname})} pair for a
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
341 qualified \var{name}.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
342 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
343
23990
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
344 \begin{methoddesc}[AttributesNS]{getQNameByName}{name}
15183
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
345 Return the qualified name for a \code{(\var{namespace},
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
346 \var{localname})} pair.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
347 \end{methoddesc}
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
348
23990
b771857ed788 [Backport of recent changes to the SAX documentation.]
Fred Drake <fdrake@acm.org>
parents: 20905
diff changeset
349 \begin{methoddesc}[AttributesNS]{getQNames}{}
15183
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
350 Return the qualified names of all attributes.
4d2187264cfa Massive addition of SAX documentation from Martin von Loewis
Fred Drake <fdrake@acm.org>
parents:
diff changeset
351 \end{methoddesc}