[][src]Struct qt_core::QXmlStreamReader

#[repr(C)]
pub struct QXmlStreamReader { /* fields omitted */ }

The QXmlStreamReader class provides a fast parser for reading well-formed XML via a simple streaming API.

C++ class: QXmlStreamReader.

C++ documentation:

The QXmlStreamReader class provides a fast parser for reading well-formed XML via a simple streaming API.

QXmlStreamReader is a faster and more convenient replacement for Qt's own SAX parser (see QXmlSimpleReader). In some cases it might also be a faster and more convenient alternative for use in applications that would otherwise use a DOM tree (see QDomDocument). QXmlStreamReader reads data either from a QIODevice (see setDevice()), or from a raw QByteArray (see addData()).

Qt provides QXmlStreamWriter for writing XML.

The basic concept of a stream reader is to report an XML document as a stream of tokens, similar to SAX. The main difference between QXmlStreamReader and SAX is how these XML tokens are reported. With SAX, the application must provide handlers (callback functions) that receive so-called XML events from the parser at the parser's convenience. With QXmlStreamReader, the application code itself drives the loop and pulls tokens from the reader, one after another, as it needs them. This is done by calling readNext(), where the reader reads from the input stream until it completes the next token, at which point it returns the tokenType(). A set of convenient functions including isStartElement() and text() can then be used to examine the token to obtain information about what has been read. The big advantage of this pulling approach is the possibility to build recursive descent parsers with it, meaning you can split your XML parsing code easily into different methods or classes. This makes it easy to keep track of the application's own state when parsing XML.

A typical loop with QXmlStreamReader looks like this:

QXmlStreamReader xml; ... while (!xml.atEnd()) { xml.readNext(); ... // do processing } if (xml.hasError()) { ... // do error handling }

QXmlStreamReader is a well-formed XML 1.0 parser that does not include external parsed entities. As long as no error occurs, the application code can thus be assured that the data provided by the stream reader satisfies the W3C's criteria for well-formed XML. For example, you can be certain that all tags are indeed nested and closed properly, that references to internal entities have been replaced with the correct replacement text, and that attributes have been normalized or added according to the internal subset of the DTD.

If an error occurs while parsing, atEnd() and hasError() return true, and error() returns the error that occurred. The functions errorString(), lineNumber(), columnNumber(), and characterOffset() are for constructing an appropriate error or warning message. To simplify application code, QXmlStreamReader contains a raiseError() mechanism that lets you raise custom errors that trigger the same error handling described.

The QXmlStream Bookmarks Example illustrates how to use the recursive descent technique to read an XML bookmark file (XBEL) with a stream reader.

Methods

impl QXmlStreamReader[src]

pub unsafe fn add_data_q_byte_array(
    &mut self,
    data: impl CastInto<Ref<QByteArray>>
)
[src]

Adds more data for the reader to read. This function does nothing if the reader has a device().

Calls C++ function: void QXmlStreamReader::addData(const QByteArray& data).

C++ documentation:

Adds more data for the reader to read. This function does nothing if the reader has a device().

See also readNext() and clear().

pub unsafe fn add_data_q_string(&mut self, data: impl CastInto<Ref<QString>>)[src]

Adds more data for the reader to read. This function does nothing if the reader has a device().

Calls C++ function: void QXmlStreamReader::addData(const QString& data).

C++ documentation:

Adds more data for the reader to read. This function does nothing if the reader has a device().

See also readNext() and clear().

pub unsafe fn add_data_char(&mut self, data: impl CastInto<Ptr<c_char>>)[src]

Adds more data for the reader to read. This function does nothing if the reader has a device().

Calls C++ function: void QXmlStreamReader::addData(const char* data).

C++ documentation:

Adds more data for the reader to read. This function does nothing if the reader has a device().

See also readNext() and clear().

pub unsafe fn add_extra_namespace_declaration(
    &mut self,
    extra_namespace_declaraction: impl CastInto<Ref<QXmlStreamNamespaceDeclaration>>
)
[src]

Adds an extraNamespaceDeclaration. The declaration will be valid for children of the current element, or - should the function be called before any elements are read - for the entire XML document.

Calls C++ function: void QXmlStreamReader::addExtraNamespaceDeclaration(const QXmlStreamNamespaceDeclaration& extraNamespaceDeclaraction).

C++ documentation:

Adds an extraNamespaceDeclaration. The declaration will be valid for children of the current element, or - should the function be called before any elements are read - for the entire XML document.

This function was introduced in Qt 4.4.

See also namespaceDeclarations(), addExtraNamespaceDeclarations(), and setNamespaceProcessing().

pub unsafe fn add_extra_namespace_declarations(
    &mut self,
    extra_namespace_declaractions: impl CastInto<Ref<QVectorOfQXmlStreamNamespaceDeclaration>>
)
[src]

Adds a vector of declarations specified by extraNamespaceDeclarations.

Calls C++ function: void QXmlStreamReader::addExtraNamespaceDeclarations(const QVector<QXmlStreamNamespaceDeclaration>& extraNamespaceDeclaractions).

C++ documentation:

Adds a vector of declarations specified by extraNamespaceDeclarations.

This function was introduced in Qt 4.4.

See also namespaceDeclarations() and addExtraNamespaceDeclaration().

pub unsafe fn at_end(&self) -> bool[src]

Returns true if the reader has read until the end of the XML document, or if an error() has occurred and reading has been aborted. Otherwise, it returns false.

Calls C++ function: bool QXmlStreamReader::atEnd() const.

C++ documentation:

Returns true if the reader has read until the end of the XML document, or if an error() has occurred and reading has been aborted. Otherwise, it returns false.

When atEnd() and hasError() return true and error() returns PrematureEndOfDocumentError, it means the XML has been well-formed so far, but a complete XML document has not been parsed. The next chunk of XML can be added with addData(), if the XML is being read from a QByteArray, or by waiting for more data to arrive if the XML is being read from a QIODevice. Either way, atEnd() will return false once more data is available.

See also hasError(), error(), device(), and QIODevice::atEnd().

pub unsafe fn attributes(&self) -> CppBox<QXmlStreamAttributes>[src]

Returns the attributes of a StartElement.

Calls C++ function: QXmlStreamAttributes QXmlStreamReader::attributes() const.

C++ documentation:

Returns the attributes of a StartElement.

pub unsafe fn character_offset(&self) -> i64[src]

Returns the current character offset, starting with 0.

Calls C++ function: qint64 QXmlStreamReader::characterOffset() const.

C++ documentation:

Returns the current character offset, starting with 0.

See also lineNumber() and columnNumber().

pub unsafe fn clear(&mut self)[src]

Removes any device() or data from the reader and resets its internal state to the initial state.

Calls C++ function: void QXmlStreamReader::clear().

C++ documentation:

Removes any device() or data from the reader and resets its internal state to the initial state.

See also addData().

pub unsafe fn column_number(&self) -> i64[src]

Returns the current column number, starting with 0.

Calls C++ function: qint64 QXmlStreamReader::columnNumber() const.

C++ documentation:

Returns the current column number, starting with 0.

See also lineNumber() and characterOffset().

pub unsafe fn device(&self) -> MutPtr<QIODevice>[src]

Returns the current device associated with the QXmlStreamReader, or 0 if no device has been assigned.

Calls C++ function: QIODevice* QXmlStreamReader::device() const.

C++ documentation:

Returns the current device associated with the QXmlStreamReader, or 0 if no device has been assigned.

See also setDevice().

pub unsafe fn document_encoding(&self) -> CppBox<QStringRef>[src]

If the tokenType() is StartDocument, this function returns the encoding string as specified in the XML declaration. Otherwise an empty string is returned.

Calls C++ function: QStringRef QXmlStreamReader::documentEncoding() const.

C++ documentation:

If the tokenType() is StartDocument, this function returns the encoding string as specified in the XML declaration. Otherwise an empty string is returned.

This function was introduced in Qt 4.4.

pub unsafe fn document_version(&self) -> CppBox<QStringRef>[src]

If the tokenType() is StartDocument, this function returns the version string as specified in the XML declaration. Otherwise an empty string is returned.

Calls C++ function: QStringRef QXmlStreamReader::documentVersion() const.

C++ documentation:

If the tokenType() is StartDocument, this function returns the version string as specified in the XML declaration. Otherwise an empty string is returned.

This function was introduced in Qt 4.4.

pub unsafe fn dtd_name(&self) -> CppBox<QStringRef>[src]

If the tokenType() is DTD, this function returns the DTD's name. Otherwise an empty string is returned.

Calls C++ function: QStringRef QXmlStreamReader::dtdName() const.

C++ documentation:

If the tokenType() is DTD, this function returns the DTD's name. Otherwise an empty string is returned.

This function was introduced in Qt 4.4.

pub unsafe fn dtd_public_id(&self) -> CppBox<QStringRef>[src]

If the tokenType() is DTD, this function returns the DTD's public identifier. Otherwise an empty string is returned.

Calls C++ function: QStringRef QXmlStreamReader::dtdPublicId() const.

C++ documentation:

If the tokenType() is DTD, this function returns the DTD's public identifier. Otherwise an empty string is returned.

This function was introduced in Qt 4.4.

pub unsafe fn dtd_system_id(&self) -> CppBox<QStringRef>[src]

If the tokenType() is DTD, this function returns the DTD's system identifier. Otherwise an empty string is returned.

Calls C++ function: QStringRef QXmlStreamReader::dtdSystemId() const.

C++ documentation:

If the tokenType() is DTD, this function returns the DTD's system identifier. Otherwise an empty string is returned.

This function was introduced in Qt 4.4.

pub unsafe fn entity_declarations(
    &self
) -> CppBox<QVectorOfQXmlStreamEntityDeclaration>
[src]

If the tokenType() is DTD, this function returns the DTD's unparsed (external) entity declarations. Otherwise an empty vector is returned.

Calls C++ function: QVector<QXmlStreamEntityDeclaration> QXmlStreamReader::entityDeclarations() const.

C++ documentation:

If the tokenType() 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.

pub unsafe fn entity_resolver(&self) -> MutPtr<QXmlStreamEntityResolver>[src]

Returns the entity resolver, or 0 if there is no entity resolver.

Calls C++ function: QXmlStreamEntityResolver* QXmlStreamReader::entityResolver() const.

C++ documentation:

Returns the entity resolver, or 0 if there is no entity resolver.

This function was introduced in Qt 4.4.

See also setEntityResolver().

pub unsafe fn error(&self) -> Error[src]

Returns the type of the current error, or NoError if no error occurred.

Calls C++ function: QXmlStreamReader::Error QXmlStreamReader::error() const.

C++ documentation:

Returns the type of the current error, or NoError if no error occurred.

See also errorString() and raiseError().

pub unsafe fn error_string(&self) -> CppBox<QString>[src]

Returns the error message that was set with raiseError().

Calls C++ function: QString QXmlStreamReader::errorString() const.

C++ documentation:

Returns the error message that was set with raiseError().

See also error(), lineNumber(), columnNumber(), and characterOffset().

pub unsafe fn has_error(&self) -> bool[src]

Returns true if an error has occurred, otherwise false.

Calls C++ function: bool QXmlStreamReader::hasError() const.

C++ documentation:

Returns true if an error has occurred, otherwise false.

See also errorString() and error().

pub unsafe fn is_c_d_a_t_a(&self) -> bool[src]

Returns true if the reader reports characters that stem from a CDATA section; otherwise returns false.

Calls C++ function: bool QXmlStreamReader::isCDATA() const.

C++ documentation:

Returns true if the reader reports characters that stem from a CDATA section; otherwise returns false.

See also isCharacters() and text().

pub unsafe fn is_characters(&self) -> bool[src]

Returns true if tokenType() equals Characters; otherwise returns false.

Calls C++ function: bool QXmlStreamReader::isCharacters() const.

C++ documentation:

Returns true if tokenType() equals Characters; otherwise returns false.

See also isWhitespace() and isCDATA().

pub unsafe fn is_comment(&self) -> bool[src]

Returns true if tokenType() equals Comment; otherwise returns false.

Calls C++ function: bool QXmlStreamReader::isComment() const.

C++ documentation:

Returns true if tokenType() equals Comment; otherwise returns false.

pub unsafe fn is_d_t_d(&self) -> bool[src]

Returns true if tokenType() equals DTD; otherwise returns false.

Calls C++ function: bool QXmlStreamReader::isDTD() const.

C++ documentation:

Returns true if tokenType() equals DTD; otherwise returns false.

pub unsafe fn is_end_document(&self) -> bool[src]

Returns true if tokenType() equals EndDocument; otherwise returns false.

Calls C++ function: bool QXmlStreamReader::isEndDocument() const.

C++ documentation:

Returns true if tokenType() equals EndDocument; otherwise returns false.

pub unsafe fn is_end_element(&self) -> bool[src]

Returns true if tokenType() equals EndElement; otherwise returns false.

Calls C++ function: bool QXmlStreamReader::isEndElement() const.

C++ documentation:

Returns true if tokenType() equals EndElement; otherwise returns false.

pub unsafe fn is_entity_reference(&self) -> bool[src]

Returns true if tokenType() equals EntityReference; otherwise returns false.

Calls C++ function: bool QXmlStreamReader::isEntityReference() const.

C++ documentation:

Returns true if tokenType() equals EntityReference; otherwise returns false.

pub unsafe fn is_processing_instruction(&self) -> bool[src]

Returns true if tokenType() equals ProcessingInstruction; otherwise returns false.

Calls C++ function: bool QXmlStreamReader::isProcessingInstruction() const.

C++ documentation:

Returns true if tokenType() equals ProcessingInstruction; otherwise returns false.

pub unsafe fn is_standalone_document(&self) -> bool[src]

Returns true if this document has been declared standalone in the XML declaration; otherwise returns false.

Calls C++ function: bool QXmlStreamReader::isStandaloneDocument() const.

C++ documentation:

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.

pub unsafe fn is_start_document(&self) -> bool[src]

Returns true if tokenType() equals StartDocument; otherwise returns false.

Calls C++ function: bool QXmlStreamReader::isStartDocument() const.

C++ documentation:

Returns true if tokenType() equals StartDocument; otherwise returns false.

pub unsafe fn is_start_element(&self) -> bool[src]

Returns true if tokenType() equals StartElement; otherwise returns false.

Calls C++ function: bool QXmlStreamReader::isStartElement() const.

C++ documentation:

Returns true if tokenType() equals StartElement; otherwise returns false.

pub unsafe fn is_whitespace(&self) -> bool[src]

Returns true if the reader reports characters that only consist of white-space; otherwise returns false.

Calls C++ function: bool QXmlStreamReader::isWhitespace() const.

C++ documentation:

Returns true if the reader reports characters that only consist of white-space; otherwise returns false.

See also isCharacters() and text().

pub unsafe fn line_number(&self) -> i64[src]

Returns the current line number, starting with 1.

Calls C++ function: qint64 QXmlStreamReader::lineNumber() const.

C++ documentation:

Returns the current line number, starting with 1.

See also columnNumber() and characterOffset().

pub unsafe fn name(&self) -> CppBox<QStringRef>[src]

Returns the local name of a StartElement, EndElement, or an EntityReference.

Calls C++ function: QStringRef QXmlStreamReader::name() const.

C++ documentation:

Returns the local name of a StartElement, EndElement, or an EntityReference.

See also namespaceUri() and qualifiedName().

pub unsafe fn namespace_declarations(
    &self
) -> CppBox<QVectorOfQXmlStreamNamespaceDeclaration>
[src]

If the tokenType() is StartElement, this function returns the element's namespace declarations. Otherwise an empty vector is returned.

Calls C++ function: QVector<QXmlStreamNamespaceDeclaration> QXmlStreamReader::namespaceDeclarations() const.

C++ documentation:

If the tokenType() is StartElement, this function returns the element's namespace declarations. Otherwise an empty vector is returned.

The QXmlStreamNamespaceDeclarations class is defined to be a QVector of QXmlStreamNamespaceDeclaration.

See also addExtraNamespaceDeclaration() and addExtraNamespaceDeclarations().

pub unsafe fn namespace_processing(&self) -> bool[src]

The namespace-processing flag of the stream reader

Calls C++ function: bool QXmlStreamReader::namespaceProcessing() const.

C++ documentation:

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:

bool namespaceProcessing() const
void setNamespaceProcessing(bool)

pub unsafe fn namespace_uri(&self) -> CppBox<QStringRef>[src]

Returns the namespaceUri of a StartElement or EndElement.

Calls C++ function: QStringRef QXmlStreamReader::namespaceUri() const.

C++ documentation:

Returns the namespaceUri of a StartElement or EndElement.

See also name() and qualifiedName().

pub unsafe fn new() -> CppBox<QXmlStreamReader>[src]

Constructs a stream reader.

Calls C++ function: [constructor] void QXmlStreamReader::QXmlStreamReader().

C++ documentation:

Constructs a stream reader.

See also setDevice() and addData().

pub unsafe fn from_q_io_device(
    device: impl CastInto<MutPtr<QIODevice>>
) -> CppBox<QXmlStreamReader>
[src]

Creates a new stream reader that reads from device.

Calls C++ function: [constructor] void QXmlStreamReader::QXmlStreamReader(QIODevice* device).

C++ documentation:

Creates a new stream reader that reads from device.

See also setDevice() and clear().

pub unsafe fn from_q_byte_array(
    data: impl CastInto<Ref<QByteArray>>
) -> CppBox<QXmlStreamReader>
[src]

Creates a new stream reader that reads from data.

Calls C++ function: [constructor] void QXmlStreamReader::QXmlStreamReader(const QByteArray& data).

C++ documentation:

Creates a new stream reader that reads from data.

See also addData(), clear(), and setDevice().

pub unsafe fn from_q_string(
    data: impl CastInto<Ref<QString>>
) -> CppBox<QXmlStreamReader>
[src]

Creates a new stream reader that reads from data.

Calls C++ function: [constructor] void QXmlStreamReader::QXmlStreamReader(const QString& data).

C++ documentation:

Creates a new stream reader that reads from data.

See also addData(), clear(), and setDevice().

pub unsafe fn from_char(
    data: impl CastInto<Ptr<c_char>>
) -> CppBox<QXmlStreamReader>
[src]

Creates a new stream reader that reads from data.

Calls C++ function: [constructor] void QXmlStreamReader::QXmlStreamReader(const char* data).

C++ documentation:

Creates a new stream reader that reads from data.

See also addData(), clear(), and setDevice().

pub unsafe fn notation_declarations(
    &self
) -> CppBox<QVectorOfQXmlStreamNotationDeclaration>
[src]

If the tokenType() is DTD, this function returns the DTD's notation declarations. Otherwise an empty vector is returned.

Calls C++ function: QVector<QXmlStreamNotationDeclaration> QXmlStreamReader::notationDeclarations() const.

C++ documentation:

If the tokenType() 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.

pub unsafe fn prefix(&self) -> CppBox<QStringRef>[src]

Returns the prefix of a StartElement or EndElement.

Calls C++ function: QStringRef QXmlStreamReader::prefix() const.

C++ documentation:

Returns the prefix of a StartElement or EndElement.

This function was introduced in Qt 4.4.

See also name() and qualifiedName().

pub unsafe fn processing_instruction_data(&self) -> CppBox<QStringRef>[src]

Returns the data of a ProcessingInstruction.

Calls C++ function: QStringRef QXmlStreamReader::processingInstructionData() const.

C++ documentation:

Returns the data of a ProcessingInstruction.

pub unsafe fn processing_instruction_target(&self) -> CppBox<QStringRef>[src]

Returns the target of a ProcessingInstruction.

Calls C++ function: QStringRef QXmlStreamReader::processingInstructionTarget() const.

C++ documentation:

Returns the target of a ProcessingInstruction.

pub unsafe fn qualified_name(&self) -> CppBox<QStringRef>[src]

Returns the qualified name of a StartElement or EndElement;

Calls C++ function: QStringRef QXmlStreamReader::qualifiedName() const.

C++ documentation:

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(), prefix(), and namespaceUri().

pub unsafe fn raise_error_1a(&mut self, message: impl CastInto<Ref<QString>>)[src]

Raises a custom error with an optional error message.

Calls C++ function: void QXmlStreamReader::raiseError(const QString& message = …).

C++ documentation:

Raises a custom error with an optional error message.

See also error() and errorString().

pub unsafe fn raise_error_0a(&mut self)[src]

Raises a custom error with an optional error message.

Calls C++ function: void QXmlStreamReader::raiseError().

C++ documentation:

Raises a custom error with an optional error message.

See also error() and errorString().

pub unsafe fn read_element_text_1a(
    &mut self,
    behaviour: ReadElementTextBehaviour
) -> CppBox<QString>
[src]

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 current token (see tokenType()) after having called this function is EndElement.

Calls C++ function: QString QXmlStreamReader::readElementText(QXmlStreamReader::ReadElementTextBehaviour behaviour = …).

C++ documentation:

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 current token (see tokenType()) after having called this function is EndElement.

The function concatenates text() when it reads either Characters or EntityReference tokens, but skips ProcessingInstruction and Comment. If the current token is not StartElement, an empty string is returned.

The behaviour defines what happens in case anything else is read before reaching EndElement. The function can include the text from child elements (useful for example for HTML), ignore child elements, or raise an UnexpectedElementError and return what was read so far (default).

This function was introduced in Qt 4.6.

pub unsafe fn read_element_text_0a(&mut self) -> CppBox<QString>[src]

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 current token (see tokenType()) after having called this function is EndElement.

Calls C++ function: QString QXmlStreamReader::readElementText().

C++ documentation:

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 current token (see tokenType()) after having called this function is EndElement.

The function concatenates text() when it reads either Characters or EntityReference tokens, but skips ProcessingInstruction and Comment. If the current token is not StartElement, an empty string is returned.

The behaviour defines what happens in case anything else is read before reaching EndElement. The function can include the text from child elements (useful for example for HTML), ignore child elements, or raise an UnexpectedElementError and return what was read so far (default).

This function was introduced in Qt 4.6.

pub unsafe fn read_next(&mut self) -> TokenType[src]

Reads the next token and returns its type.

Calls C++ function: QXmlStreamReader::TokenType QXmlStreamReader::readNext().

C++ documentation:

Reads the next token and returns its type.

With one exception, once an error() is reported by readNext(), further reading of the XML stream is not possible. Then atEnd() returns true, hasError() returns true, and this function returns QXmlStreamReader::Invalid.

The exception is when error() returns PrematureEndOfDocumentError. This error is reported when the end of an otherwise well-formed chunk of XML is reached, but the chunk doesn't represent a complete XML document. In that case, parsing can be resumed by calling addData() to add the next chunk of XML, when the stream is being read from a QByteArray, or by waiting for more data to arrive when the stream is being read from a device().

See also tokenType() and tokenString().

pub unsafe fn read_next_start_element(&mut self) -> bool[src]

Reads until the next start element within the current element. Returns true when a start element was reached. When the end element was reached, or when an error occurred, false is returned.

Calls C++ function: bool QXmlStreamReader::readNextStartElement().

C++ documentation:

Reads until the next start element within the current element. Returns true when a start element was reached. When the end element was reached, or when an error occurred, false is returned.

The current element is the element matching the most recently parsed start element of which a matching end element has not yet been reached. When the parser has reached the end element, the current element becomes the parent element.

This is a convenience function for when you're only concerned with parsing XML elements. The QXmlStream Bookmarks Example makes extensive use of this function.

This function was introduced in Qt 4.6.

See also readNext().

pub unsafe fn set_device(&mut self, device: impl CastInto<MutPtr<QIODevice>>)[src]

Sets the current device to device. Setting the device resets the stream to its initial state.

Calls C++ function: void QXmlStreamReader::setDevice(QIODevice* device).

C++ documentation:

Sets the current device to device. Setting the device resets the stream to its initial state.

See also device() and clear().

pub unsafe fn set_entity_resolver(
    &mut self,
    resolver: impl CastInto<MutPtr<QXmlStreamEntityResolver>>
)
[src]

Makes resolver the new entityResolver().

Calls C++ function: void QXmlStreamReader::setEntityResolver(QXmlStreamEntityResolver* resolver).

C++ documentation:

Makes resolver the new entityResolver().

The stream reader does not take ownership of the resolver. It's the callers responsibility to ensure that the resolver is valid during the entire life-time of the stream reader object, or until another resolver or 0 is set.

This function was introduced in Qt 4.4.

See also entityResolver().

pub unsafe fn set_namespace_processing(&mut self, arg1: bool)[src]

The namespace-processing flag of the stream reader

Calls C++ function: void QXmlStreamReader::setNamespaceProcessing(bool arg1).

C++ documentation:

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:

bool namespaceProcessing() const
void setNamespaceProcessing(bool)

pub unsafe fn skip_current_element(&mut self)[src]

Reads until the end of the current element, skipping any child nodes. This function is useful for skipping unknown elements.

Calls C++ function: void QXmlStreamReader::skipCurrentElement().

C++ documentation:

Reads until the end of the current element, skipping any child nodes. This function is useful for skipping unknown elements.

The current element is the element matching the most recently parsed start element of which a matching end element has not yet been reached. When the parser has reached the end element, the current element becomes the parent element.

This function was introduced in Qt 4.6.

pub unsafe fn text(&self) -> CppBox<QStringRef>[src]

Returns the text of Characters, Comment, DTD, or EntityReference.

Calls C++ function: QStringRef QXmlStreamReader::text() const.

C++ documentation:

Returns the text of Characters, Comment, DTD, or EntityReference.

pub unsafe fn token_string(&self) -> CppBox<QString>[src]

Returns the reader's current token as string.

Calls C++ function: QString QXmlStreamReader::tokenString() const.

C++ documentation:

Returns the reader's current token as string.

See also tokenType().

pub unsafe fn token_type(&self) -> TokenType[src]

Returns the type of the current token.

Calls C++ function: QXmlStreamReader::TokenType QXmlStreamReader::tokenType() const.

C++ documentation:

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().

Trait Implementations

impl CppDeletable for QXmlStreamReader[src]

unsafe fn delete(&mut self)[src]

Destructs the reader.

Calls C++ function: [destructor] void QXmlStreamReader::~QXmlStreamReader().

C++ documentation:

Destructs the reader.

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]