QXmlStreamReader Class Reference |
Constant | Value | Description |
---|---|---|
QXmlStreamReader::NoError | 0 | No error has occurred. |
QXmlStreamReader::CustomError | 2 | A custom error has been raised with raiseError() |
QXmlStreamReader::NotWellFormedError | 3 | The parser internally raised an error due to the read XML not being well-formed. |
QXmlStreamReader::PrematureEndOfDocumentError | 4 | The input stream ended before the document was parsed completely. This error can be recovered from. |
QXmlStreamReader::UnexpectedElementError | 1 | The parser encountered an element that was different to those it expected. |
This enum specifies the type of token the reader just read.
Constant | Value | Description |
---|---|---|
QXmlStreamReader::NoToken | 0 | The reader has not yet read anything. |
QXmlStreamReader::Invalid | 1 | An error has occurred, reported in error() and errorString(). |
QXmlStreamReader::StartDocument | 2 | The reader reports the start of the document. If the document is declared standalone, isStandaloneDocument() returns true; otherwise it returns false. |
QXmlStreamReader::EndDocument | 3 | The reader reports the end of the document. |
QXmlStreamReader::StartElement | 4 | The reader reports the start of an element with namespaceUri() and name(). Empty elements are also reported as StartElement, followed directly by EndElement. The convenience function readElementText() can be called to concatenate all content until the corresponding EndElement. Attributes are reported in attributes(), namespace declarations in namespaceDeclarations(). |
QXmlStreamReader::EndElement | 5 | The reader reports the end of an element with namespaceUri() and name(). |
QXmlStreamReader::Characters | 6 | The reader reports characters in text(). If the characters are all white-space, isWhitespace() returns true. If the characters stem from a CDATA section, isCDATA() returns true. |
QXmlStreamReader::Comment | 7 | The reader reports a comment in text(). |
QXmlStreamReader::DTD | 8 | The reader reports a DTD in text(), notation declarations in notationDeclarations(). |
QXmlStreamReader::EntityReference | 9 | The reader reports an entity reference that could not be resolved. The name of the reference is reported in name(), the replacement text in text(). |
QXmlStreamReader::ProcessingInstruction | 10 | The reader reports a processing instruction in processingInstructionTarget() and processingInstructionData(). |
the namespace-processing flag of the stream reader
This property controls whether or not the stream reader processes namespaces. If enabled, the reader processes namespaces, otherwise it does not.
By default, namespace-processing is enabled.
Access functions:
Constructs a stream reader.
See also setDevice() and addData().
Creates a new stream reader that reads from device.
See also setDevice() and clear().
Creates a new stream reader that reads from data.
See also addData(), clear(), and setDevice().
Creates a new stream reader that reads from data.
See also addData(), clear(), and setDevice().
Creates a new stream reader that reads from data.
See also addData(), clear(), and setDevice().
Destructs the reader.
Adds more data for the reader to read.
This function does nothing if the reader has a device().
See also clear().
This is an overloaded member function, provided for convenience.
Adds more data for the reader to read.
This function does nothing if the reader has a device().
See also clear().
This is an overloaded member function, provided for convenience.
Adds more data for the reader to read.
This function does nothing if the reader has a device().
See also clear().
Returns true if the reader has read until the end of the XML document, or an error has occurred and reading has been aborted; otherwise returns false.
Has reading been aborted with a PrematureEndOfDocumentError because the device no longer delivered data, atEnd() will return true once more data has arrived.
See also device() and QIODevice::atEnd().
Returns the attributes of a StartElement.
Returns the current character offset, starting with 0.
See also lineNumber() and columnNumber().
Removes any device() or data from the reader, and resets its state to the initial state.
See also addData().
Returns the current column number, starting with 0.
See also lineNumber() and characterOffset().
Returns the current device associated with the QXmlStreamReader, or 0 if no device has been assigned.
See also setDevice().
If the state() is DTD, this function returns the DTD's unparsed (external) entity declarations. Otherwise an empty vector is returned.
The QXmlStreamEntityDeclarations class is defined to be a QVector of QXmlStreamEntityDeclaration.
Returns the type of the current error, or NoError if no error occurred.
See also errorString() and raiseError().
Returns the error message that was set with raiseError().
See also error(), lineNumber(), columnNumber(), and characterOffset().
Returns true if an error has occurred, otherwise false.
See also errorString() and error().
Returns true if the reader reports characters that stem from a CDATA section; otherwise returns false.
See also isCharacters() and text().
Returns true if tokenType() equals Characters; otherwise returns false.
See also isWhitespace() and isCDATA().
Returns true if tokenType() equals Comment; otherwise returns false.
Returns true if tokenType() equals DTD; otherwise returns false.
Returns true if tokenType() equals EndDocument; otherwise returns false.
Returns true if tokenType() equals EndElement; otherwise returns false.
Returns true if tokenType() equals EntityReference; otherwise returns false.
Returns true if tokenType() equals ProcessingInstruction; otherwise returns false.
Returns true if this document has been declared standalone in the XML declaration; otherwise returns false.
If no XML declaration has been parsed, this function returns false.
Returns true if tokenType() equals StartDocument; otherwise returns false.
Returns true if tokenType() equals StartElement; otherwise returns false.
Returns true if the reader reports characters that only consist of white-space; otherwise returns false.
See also isCharacters() and text().
Returns the current line number, starting with 1.
See also columnNumber() and characterOffset().
Returns the local name of a StartElement, EndElement, or an EntityReference.
See also namespaceUri() and qualifiedName().
If the state() is StartElement, this function returns the element's namespace declarations. Otherwise an empty vector is returned.
The QXmlStreamNamespaceDeclaration class is defined to be a QVector of QXmlStreamNamespaceDeclaration.
Returns the namespaceUri of a StartElement or EndElement.
See also name() and qualifiedName().
If the state() is DTD, this function returns the DTD's notation declarations. Otherwise an empty vector is returned.
The QXmlStreamNotationDeclarations class is defined to be a QVector of QXmlStreamNotationDeclaration.
Returns the data of a ProcessingInstruction.
Returns the target of a ProcessingInstruction.
Returns the qualified name of a StartElement or EndElement;
A qualified name is the raw name of an element in the XML data. It consists of the namespace prefix, followed by colon, followed by the element's local name. Since the namespace prefix is not unique (the same prefix can point to different namespaces and different prefixes can point to the same namespace), you shouldn't use qualifiedName(), but the resolved namespaceUri() and the attribute's local name().
See also name() and namespaceUri().
Raises a custom error with an optional error message.
See also error() and errorString().
Convenience function to be called in case a StartElement was read. Reads until the corresponding EndElement and returns all text in-between. In case of no error, the token after having called this function is EndElement.
The function concatenates text() when it reads either Characters or EntityReference tokens, but skips ProcessingInstruction and Comment. In case anything else is read before reaching EndElement, the function returns what it read so far and raises an UnexpectedElementError. If the current token is not StartElement, an empty string is returned.
Reads the next token and returns its type.
If an error() has been reported, reading is no longer possible. In this case, atEnd() always returns true, and this function will do nothing but return Invalid.
The one exception to this rule are errors of type PrematureEndOfDocumentError. Subsequent calls to atEnd() and readNext() will resume this error type and try to read from the device again. This iterative parsing approach makes sense if you can't or don't want to read the entire data in one go, for example, if it is huge, or it is being delivered over a network connection
See also tokenType() and tokenString().
Sets the current device to device. Setting the device resets the stream to its initial state.
See also device() and clear().
Returns the text of Characters, Comment, DTD, or EntityReference.
Returns the reader's current token as string.
See also tokenType().
Returns the type of the current token.
The current token can also be queried with the convenience functions isStartDocument(), isEndDocument(), isStartElement(), isEndElement(), isCharacters(), isComment(), isDTD(), isEntityReference(), and isProcessingInstruction()
See also tokenString().
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.3 | |
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