QXmlSerializer Class Reference |
QXmlSerializer ( const QXmlQuery & query, QIODevice * outputDevice ) | |
const QTextCodec * | codec () const |
QIODevice * | outputDevice () const |
void | setCodec ( const QTextCodec * outputCodec ) |
virtual void | atomicValue ( const QVariant & value ) |
virtual void | attribute ( const QXmlName & name, const QStringRef & value ) |
virtual void | characters ( const QStringRef & value ) |
virtual void | comment ( const QString & value ) |
virtual void | endDocument () |
virtual void | endElement () |
virtual void | endOfSequence () |
virtual void | namespaceBinding ( const QXmlName & nb ) |
virtual void | processingInstruction ( const QXmlName & name, const QString & value ) |
virtual void | startDocument () |
virtual void | startElement ( const QXmlName & name ) |
virtual void | startOfSequence () |
The QXmlSerializer class is an implementation of QAbstractXmlReceiver for transforming XQuery output into unformatted XML.
QXmlSerializer translates an XQuery sequence, usually the output of an QXmlQuery, into XML. Consider the example:
QXmlQuery query; query.setQuery("doc('index.html')/html/body/p[1]"); QXmlSerializer serializer(query, myOutputDevice); query.evaluateTo(&serializer);
First it constructs a query that gets the first paragraph from document index.html. Then it constructs an instance of this class with the query and myOutputDevice. Finally, it evaluates the query, producing an ordered sequence of calls to the serializer's callback functions. The sequence of callbacks transforms the query output to XML and writes it to myOutputDevice.
QXmlSerializer will:
If an error occurs during serialization, result is undefined unless the serializer is driven through a call to QXmlQuery::evaluateTo().
If the generated XML should be indented and formatted for reading, use QXmlFormatter.
See also XSLT 2.0 and XQuery 1.0 Serialization and QXmlFormatter.
Constructs a serializer that uses the name pool and message handler in query, and writes the output to outputDevice.
outputDevice must be a valid, non-null device that is open in write mode, otherwise behavior is undefined.
outputDevice must not be opened with QIODevice::Text because it will cause the output to be incorrect. This class will ensure line endings are serialized as according with the XML specification. QXmlSerializer does not take ownership of outputDevice.
Reimplemented from QAbstractXmlReceiver::atomicValue().
Reimplemented from QAbstractXmlReceiver::attribute().
Reimplemented from QAbstractXmlReceiver::characters().
Returns the codec being used by the serializer for encoding its XML output.
See also setCodec().
Reimplemented from QAbstractXmlReceiver::comment().
Reimplemented from QAbstractXmlReceiver::endDocument().
Reimplemented from QAbstractXmlReceiver::endElement().
Reimplemented from QAbstractXmlReceiver::endOfSequence().
Reimplemented from QAbstractXmlReceiver::namespaceBinding().
Returns a pointer to the output device. There is no corresponding function to set the output device, because the output device must be passed to the constructor. The serializer does not take ownership of its IO device.
Reimplemented from QAbstractXmlReceiver::processingInstruction().
Sets the codec the serializer will use for encoding its XML output. The output codec is set to outputCodec. By default, the output codec is set to the one for UTF-8. The serializer does not take ownership of the codec.
See also codec().
Reimplemented from QAbstractXmlReceiver::startDocument().
Reimplemented from QAbstractXmlReceiver::startElement().
Reimplemented from QAbstractXmlReceiver::startOfSequence().
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 4.6 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com