1QXmlContentHandler(3qt) QXmlContentHandler(3qt)
2
3
4
6 QXmlContentHandler - Interface to report the logical content of XML
7 data
8
10 All the functions in this class are reentrant when Qt is built with
11 thread support.</p>
12
13 #include <qxml.h>
14
15 Inherited by QXmlDefaultHandler.
16
17 Public Members
18 virtual void setDocumentLocator ( QXmlLocator * locator ) = 0
19 virtual bool startDocument () = 0
20 virtual bool endDocument () = 0
21 virtual bool startPrefixMapping ( const QString & prefix, const QString
22 & uri ) = 0
23 virtual bool endPrefixMapping ( const QString & prefix ) = 0
24 virtual bool startElement ( const QString & namespaceURI, const QString
25 & localName, const QString & qName, const QXmlAttributes & atts ) =
26 0
27 virtual bool endElement ( const QString & namespaceURI, const QString &
28 localName, const QString & qName ) = 0
29 virtual bool characters ( const QString & ch ) = 0
30 virtual bool ignorableWhitespace ( const QString & ch ) = 0
31 virtual bool processingInstruction ( const QString & target, const
32 QString & data ) = 0
33 virtual bool skippedEntity ( const QString & name ) = 0
34 virtual QString errorString () = 0
35
37 The QXmlContentHandler class provides an interface to report the
38 logical content of XML data.
39
40 If the application needs to be informed of basic parsing events, it can
41 implement this interface and activate it using
42 QXmlReader::setContentHandler(). The reader can then report basic
43 document-related events like the start and end of elements and
44 character data through this interface.
45
46 The order of events in this interface is very important, and mirrors
47 the order of information in the document itself. For example, all of an
48 element's content (character data, processing instructions, and sub-
49 elements) appears, in order, between the startElement() event and the
50 corresponding endElement() event.
51
52 The class QXmlDefaultHandler provides a default implementation for this
53 interface; subclassing from the QXmlDefaultHandler class is very
54 convenient if you only want to be informed of some parsing events.
55
56 The startDocument() function is called at the start of the document,
57 and endDocument() is called at the end. Before parsing begins
58 setDocumentLocator() is called. For each element startElement() is
59 called, with endElement() being called at the end of each element. The
60 characters() function is called with chunks of character data;
61 ignorableWhitespace() is called with chunks of whitespace and
62 processingInstruction() is called with processing instructions. If an
63 entity is skipped skippedEntity() is called. At the beginning of
64 prefix-URI scopes startPrefixMapping() is called.
65
66 See also the Introduction to SAX2.
67
68 See also QXmlDTDHandler, QXmlDeclHandler, QXmlEntityResolver,
69 QXmlErrorHandler, QXmlLexicalHandler, and XML.
70
73 The reader calls this function when it has parsed a chunk of character
74 data (either normal character data or character data inside a CDATA
75 section; if you need to distinguish between those two types you must
76 use QXmlLexicalHandler::startCDATA() and
77 QXmlLexicalHandler::endCDATA()). The character data is reported in ch.
78
79 Some readers report whitespace in element content using the
80 ignorableWhitespace() function rather than using this one.
81
82 A reader may report the character data of an element in more than one
83 chunk; e.g. a reader might want to report "a<b" in three characters()
84 events ("a ", "<" and " b").
85
86 If this function returns FALSE the reader stops parsing and reports an
87 error. The reader uses the function errorString() to get the error
88 message.
89
91 The reader calls this function after it has finished parsing. It is
92 called just once, and is the last handler function called. It is called
93 after the reader has read all input or has abandoned parsing because of
94 a fatal error.
95
96 If this function returns FALSE the reader stops parsing and reports an
97 error. The reader uses the function errorString() to get the error
98 message.
99
100 See also startDocument().
101
103 QString & localName, const QString & qName ) [pure virtual]
104 The reader calls this function when it has parsed an end element tag
105 with the qualified name qName, the local name localName and the
106 namespace URI namespaceURI.
107
108 If this function returns FALSE the reader stops parsing and reports an
109 error. The reader uses the function errorString() to get the error
110 message.
111
112 See also the namespace description.
113
114 See also startElement().
115
116 Example: xml/tagreader/structureparser.cpp.
117
119 virtual]
120 The reader calls this function to signal the end of a prefix mapping
121 for the prefix prefix.
122
123 If this function returns FALSE the reader stops parsing and reports an
124 error. The reader uses the function errorString() to get the error
125 message.
126
127 See also the namespace description.
128
129 See also startPrefixMapping().
130
132 The reader calls this function to get an error string, e.g. if any of
133 the handler functions returns FALSE.
134
136 virtual]
137 Some readers may use this function to report each chunk of whitespace
138 in element content. The whitespace is reported in ch.
139
140 If this function returns FALSE the reader stops parsing and reports an
141 error. The reader uses the function errorString() to get the error
142 message.
143
145 QString & data ) [pure virtual]
146 The reader calls this function when it has parsed a processing
147 instruction.
148
149 target is the target name of the processing instruction and data is the
150 data in the processing instruction.
151
152 If this function returns FALSE the reader stops parsing and reports an
153 error. The reader uses the function errorString() to get the error
154 message.
155
157 virtual]
158 The reader calls this function before it starts parsing the document.
159 The argument locator is a pointer to a QXmlLocator which allows the
160 application to get the parsing position within the document.
161
162 Do not destroy the locator; it is destroyed when the reader is
163 destroyed. (Do not use the locator after the reader is destroyed).
164
166
167 Some readers may skip entities if they have not seen the declarations
168 (e.g. because they are in an external DTD). If they do so they report
169 that they skipped the entity called name by calling this function.
170
171 If this function returns FALSE the reader stops parsing and reports an
172 error. The reader uses the function errorString() to get the error
173 message.
174
176 The reader calls this function when it starts parsing the document. The
177 reader calls this function just once, after the call to
178 setDocumentLocator(), and before any other functions in this class or
179 in the QXmlDTDHandler class are called.
180
181 If this function returns FALSE the reader stops parsing and reports an
182 error. The reader uses the function errorString() to get the error
183 message.
184
185 See also endDocument().
186
187 Example: xml/tagreader/structureparser.cpp.
188
190 QString & localName, const QString & qName, const QXmlAttributes & atts
191 ) [pure virtual]
192 The reader calls this function when it has parsed a start element tag.
193
194 There is a corresponding endElement() call when the corresponding end
195 element tag is read. The startElement() and endElement() calls are
196 always nested correctly. Empty element tags (e.g. <x/>) cause a
197 startElement() call to be immediately followed by an endElement() call.
198
199 The attribute list provided only contains attributes with explicit
200 values. The attribute list contains attributes used for namespace
201 declaration (i.e. attributes starting with xmlns) only if the
202 namespace-prefix property of the reader is TRUE.
203
204 The argument namespaceURI is the namespace URI, or QString::null if the
205 element has no namespace URI or if no namespace processing is done.
206 localName is the local name (without prefix), or QString::null if no
207 namespace processing is done, qName is the qualified name (with prefix)
208 and atts are the attributes attached to the element. If there are no
209 attributes, atts is an empty attributes object.
210
211 If this function returns FALSE the reader stops parsing and reports an
212 error. The reader uses the function errorString() to get the error
213 message.
214
215 See also the namespace description.
216
217 See also endElement().
218
219 Example: xml/tagreader/structureparser.cpp.
220
222 QString & uri ) [pure virtual]
223 The reader calls this function to signal the begin of a prefix-URI
224 namespace mapping scope. This information is not necessary for normal
225 namespace processing since the reader automatically replaces prefixes
226 for element and attribute names.
227
228 Note that startPrefixMapping() and endPrefixMapping() calls are not
229 guaranteed to be properly nested relative to each other: all
230 startPrefixMapping() events occur before the corresponding
231 startElement() event, and all endPrefixMapping() events occur after the
232 corresponding endElement() event, but their order is not otherwise
233 guaranteed.
234
235 The argument prefix is the namespace prefix being declared and the
236 argument uri is the namespace URI the prefix is mapped to.
237
238 If this function returns FALSE the reader stops parsing and reports an
239 error. The reader uses the function errorString() to get the error
240 message.
241
242 See also the namespace description.
243
244 See also endPrefixMapping().
245
246
248 http://doc.trolltech.com/qxmlcontenthandler.html
249 http://www.trolltech.com/faq/tech.html
250
252 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
253 license file included in the distribution for a complete license
254 statement.
255
257 Generated automatically from the source code.
258
260 If you find a bug in Qt, please report it as described in
261 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
262 help you. Thank you.
263
264 The definitive Qt documentation is provided in HTML format; it is
265 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
266 web browser. This man page is provided as a convenience for those users
267 who prefer man pages, although this format is not officially supported
268 by Trolltech.
269
270 If you find errors in this manual page, please report them to qt-
271 bugs@trolltech.com. Please include the name of the manual page
272 (qxmlcontenthandler.3qt) and the Qt version (3.3.8).
273
274
275
276Trolltech AS 2 February 2007 QXmlContentHandler(3qt)