📄 qxmlinputsource.3qt
字号:
'\" t.TH QXmlInputSource 3qt "9 December 2002" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQXmlInputSource \- The input data for the QXmlReader subclasses.SH SYNOPSIS\fC#include <qxml.h>\fR.PP.SS "Public Members".in +1c.ti -1c.BI "\fBQXmlInputSource\fR ()".br.ti -1c.BI "\fBQXmlInputSource\fR ( QIODevice * dev )".br.ti -1c.BI "QXmlInputSource ( QFile & file ) \fI(obsolete)\fR".br.ti -1c.BI "QXmlInputSource ( QTextStream & stream ) \fI(obsolete)\fR".br.ti -1c.BI "virtual \fB~QXmlInputSource\fR ()".br.ti -1c.BI "virtual void \fBsetData\fR ( const QString & dat )".br.ti -1c.BI "virtual void \fBsetData\fR ( const QByteArray & dat )".br.ti -1c.BI "virtual void \fBfetchData\fR ()".br.ti -1c.BI "virtual QString \fBdata\fR ()".br.ti -1c.BI "virtual QChar \fBnext\fR ()".br.ti -1c.BI "virtual void \fBreset\fR ()".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "virtual QString \fBfromRawData\fR ( const QByteArray & data, bool beginning = FALSE )".br.in -1c.SH DESCRIPTIONThe QXmlInputSource class provides the input data for the QXmlReader subclasses..PPAll subclasses of QXmlReader read the input XML document from this class..PPThis class recognizes the encoding of the data by reading the encoding declaration in the XML file if it finds one, and reading the data using the corresponding encoding. If it does not find an encoding declaration, then it assumes that the data is either in UTF-8 or UTF-16, depending on whether it can find a byte-order mark..PPThere are two ways to populate the input source with data: you can construct it with a QIODevice* so that the input source reads the data from that device. Or you can set the data explicitly with one of the setData() functions..PPUsually you either construct a QXmlInputSource that works on a QIODevice* or you construct an empty QXmlInputSource and set the data with setData(). There are only rare occasions where you want to mix both methods..PPThe subclasses of QXmlReader use the next() function to read the input character by character. If you want to start from the beginning again, use reset()..PPThe functions data() and fetchData() are useful if you want to do something with the data other than parsing, e.g. displaying the raw XML file. The benefit of using the QXmlInputClass in such cases is that it tries to use the correct encoding..PPSee also QXmlReader, QXmlSimpleReader, and XML..SH MEMBER FUNCTION DOCUMENTATION.SH "QXmlInputSource::QXmlInputSource ()"Constructs an input source which contains no data..PPSee also setData()..SH "QXmlInputSource::QXmlInputSource ( QIODevice * dev )"Constructs an input source and gets the data from device \fIdev\fR. If \fIdev\fR is not open, it is opened in read-only mode. If \fIdev\fR is 0 or it is not possible to read from the device, the input source will contain no data..PPSee also setData(), fetchData(), and QIODevice..SH "QXmlInputSource::QXmlInputSource ( QFile & file )"\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..PPConstructs an input source and gets the data from the file \fIfile\fR. If the file cannot be read the input source is empty..SH "QXmlInputSource::QXmlInputSource ( QTextStream & stream )"\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..PPConstructs an input source and gets the data from the text stream \fIstream\fR..SH "QXmlInputSource::~QXmlInputSource ()\fC [virtual]\fR"Destructor..SH "QString QXmlInputSource::data ()\fC [virtual]\fR"Returns the data the input source contains or QString::null if the input source does not contain any data..PPSee also setData(), QXmlInputSource(), and fetchData()..SH "void QXmlInputSource::fetchData ()\fC [virtual]\fR"This function reads more data from the device that was set during construction. If the input source already contained data, this function deletes that data first..PPThis object contains no data after a call to this function if the object was constructed without a device to read data from or if this function was not able to get more data from the device..PPThere are two occasions where a fetch is done implicitly by another function call: during construction (so the object starts out with some initial data where available), and during a call to next() (if the data had run out)..PPYou don't normally need to use this function if you use next()..PPSee also data(), next(), and QXmlInputSource()..SH "QString QXmlInputSource::fromRawData ( const QByteArray & data, bool beginning = FALSE )\fC [virtual protected]\fR"This function reads the XML file from \fIdata\fR and tries to recognize the encoding. It converts the raw data \fIdata\fR into a QString and returns it. It tries its best to get the correct encoding for the XML file..PPIf \fIbeginning\fR is TRUE, this function assumes that the data starts at the beginning of a new XML document and looks for an encoding declaration. If \fIbeginning\fR is FALSE, it converts the raw data using the encoding determined from prior calls..SH "QChar QXmlInputSource::next ()\fC [virtual]\fR"Returns the next character of the input source. If this function reaches the end of available data, it returns QXmlInputSource::EndOfData. If you call next() after that, it tries to fetch more data by calling fetchData(). If the fetchData() call results in new data, this function returns the first character of that data; otherwise it returns QXmlInputSource::EndOfDocument..PPSee also reset(), fetchData(), QXmlSimpleReader::parse(), and QXmlSimpleReader::parseContinue()..SH "void QXmlInputSource::reset ()\fC [virtual]\fR"This function sets the position used by next() to the beginning of the data returned by data(). This is useful if you want to use the input source for more than one parse..PPSee also next()..PPExample: xml/tagreader-with-features/tagreader.cpp..SH "void QXmlInputSource::setData ( const QString & dat )\fC [virtual]\fR"Sets the data of the input source to \fIdat\fR..PPIf the input source already contains data, this function deletes that data first..PPSee also data()..SH "void QXmlInputSource::setData ( const QByteArray & dat )\fC [virtual]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPThe data \fIdat\fR is passed through the correct text-codec, beforeit is set..SH "SEE ALSO".BR http://doc.trolltech.com/qxmlinputsource.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qxmlinputsource.3qt) and the Qtversion (3.1.1).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -