1QXmlInputSource(3qt) QXmlInputSource(3qt)
2
3
4
6 QXmlInputSource - The input data for the QXmlReader subclasses
7
9 All the functions in this class are reentrant when Qt is built with
10 thread support.</p>
11
12 #include <qxml.h>
13
14 Public Members
15 QXmlInputSource ()
16 QXmlInputSource ( QIODevice * dev )
17 QXmlInputSource ( QFile & file ) (obsolete)
18 QXmlInputSource ( QTextStream & stream ) (obsolete)
19 virtual ~QXmlInputSource ()
20 virtual void setData ( const QString & dat )
21 virtual void setData ( const QByteArray & dat )
22 virtual void fetchData ()
23 virtual QString data ()
24 virtual QChar next ()
25 virtual void reset ()
26
27 Protected Members
28 virtual QString fromRawData ( const QByteArray & data, bool beginning =
29 FALSE )
30
32 The QXmlInputSource class provides the input data for the QXmlReader
33 subclasses.
34
35 All subclasses of QXmlReader read the input XML document from this
36 class.
37
38 This class recognizes the encoding of the data by reading the encoding
39 declaration in the XML file if it finds one, and reading the data using
40 the corresponding encoding. If it does not find an encoding
41 declaration, then it assumes that the data is either in UTF-8 or
42 UTF-16, depending on whether it can find a byte-order mark.
43
44 There are two ways to populate the input source with data: you can
45 construct it with a QIODevice* so that the input source reads the data
46 from that device. Or you can set the data explicitly with one of the
47 setData() functions.
48
49 Usually you either construct a QXmlInputSource that works on a
50 QIODevice* or you construct an empty QXmlInputSource and set the data
51 with setData(). There are only rare occasions where you would want to
52 mix both methods.
53
54 The QXmlReader subclasses use the next() function to read the input
55 character by character. If you want to start from the beginning again,
56 use reset().
57
58 The functions data() and fetchData() are useful if you want to do
59 something with the data other than parsing, e.g. displaying the raw XML
60 file. The benefit of using the QXmlInputClass in such cases is that it
61 tries to use the correct encoding.
62
63 See also QXmlReader, QXmlSimpleReader, and XML.
64
67 Constructs an input source which contains no data.
68
69 See also setData().
70
72 Constructs an input source and gets the data from device dev. If dev is
73 not open, it is opened in read-only mode. If dev is 0 or it is not
74 possible to read from the device, the input source will contain no
75 data.
76
77 See also setData(), fetchData(), and QIODevice.
78
80 This function is obsolete. It is provided to keep old source working.
81 We strongly advise against using it in new code.
82
83 Constructs an input source and gets the data from the file file. If the
84 file cannot be read the input source is empty.
85
87 This function is obsolete. It is provided to keep old source working.
88 We strongly advise against using it in new code.
89
90 Constructs an input source and gets the data from the text stream
91 stream.
92
94 Destructor.
95
97 Returns the data the input source contains or QString::null if the
98 input source does not contain any data.
99
100 See also setData(), QXmlInputSource(), and fetchData().
101
103 This function reads more data from the device that was set during
104 construction. If the input source already contained data, this function
105 deletes that data first.
106
107 This object contains no data after a call to this function if the
108 object was constructed without a device to read data from or if this
109 function was not able to get more data from the device.
110
111 There are two occasions where a fetch is done implicitly by another
112 function call: during construction (so that the object starts out with
113 some initial data where available), and during a call to next() (if the
114 data had run out).
115
116 You don't normally need to use this function if you use next().
117
118 See also data(), next(), and QXmlInputSource().
119
121 = FALSE ) [virtual protected]
122 This function reads the XML file from data and tries to recognize the
123 encoding. It converts the raw data data into a QString and returns it.
124 It tries its best to get the correct encoding for the XML file.
125
126 If beginning is TRUE, this function assumes that the data starts at the
127 beginning of a new XML document and looks for an encoding declaration.
128 If beginning is FALSE, it converts the raw data using the encoding
129 determined from prior calls.
130
132 Returns the next character of the input source. If this function
133 reaches the end of available data, it returns
134 QXmlInputSource::EndOfData. If you call next() after that, it tries to
135 fetch more data by calling fetchData(). If the fetchData() call results
136 in new data, this function returns the first character of that data;
137 otherwise it returns QXmlInputSource::EndOfDocument.
138
139 See also reset(), fetchData(), QXmlSimpleReader::parse(), and
140 QXmlSimpleReader::parseContinue().
141
143 This function sets the position used by next() to the beginning of the
144 data returned by data(). This is useful if you want to use the input
145 source for more than one parse.
146
147 See also next().
148
149 Example: xml/tagreader-with-features/tagreader.cpp.
150
152 Sets the data of the input source to dat.
153
154 If the input source already contains data, this function deletes that
155 data first.
156
157 See also data().
158
160 This is an overloaded member function, provided for convenience. It
161 behaves essentially like the above function.
162
163 The data dat is passed through the correct text-codec, before it is
164 set.
165
166
168 http://doc.trolltech.com/qxmlinputsource.html
169 http://www.trolltech.com/faq/tech.html
170
172 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
173 license file included in the distribution for a complete license
174 statement.
175
177 Generated automatically from the source code.
178
180 If you find a bug in Qt, please report it as described in
181 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
182 help you. Thank you.
183
184 The definitive Qt documentation is provided in HTML format; it is
185 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
186 web browser. This man page is provided as a convenience for those users
187 who prefer man pages, although this format is not officially supported
188 by Trolltech.
189
190 If you find errors in this manual page, please report them to qt-
191 bugs@trolltech.com. Please include the name of the manual page
192 (qxmlinputsource.3qt) and the Qt version (3.3.8).
193
194
195
196Trolltech AS 2 February 2007 QXmlInputSource(3qt)