Skip to content

XmlStreamReader

Qt Base Class: QXmlStreamReader

Signature: QXmlStreamReader(self) -> None QXmlStreamReader(self, data: str) -> None QXmlStreamReader(self, device: PySide6.QtCore.QIODevice) -> None

Base classes

Name Children Inherits
QXmlStreamReader
PySide6.QtCore
QXmlStreamReader(self) -> None

⋔ Inheritance diagram

graph TD
  1473299911648["core.XmlStreamReader"]
  1473243733472["QtCore.QXmlStreamReader"]
  1473291690208["Shiboken.Object"]
  140713234304496["builtins.object"]
  1473243733472 --> 1473299911648
  1473291690208 --> 1473243733472
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: QXmlStreamReader

Fast parser for reading well-formed XML via a simple streaming API.

Source code in prettyqt\core\xmlstreamreader.py
class XmlStreamReader(QtCore.QXmlStreamReader):
    """Fast parser for reading well-formed XML via a simple streaming API."""

    def __iter__(self):
        return self

    def __next__(self):
        while not self.atEnd():
            self.readNext()
            if self.hasError():
                raise RuntimeError(self.get_error())
            return self
        raise StopIteration

    def get_error(self) -> ErrorStr:
        """Return file error status.

        Returns:
            file error status
        """
        return ERROR.inverse[self.error()]

    def get_token_type(self) -> TokenTypeStr:
        """Get the current token type.

        Returns:
            token type
        """
        return TOKEN_TYPE.inverse[self.tokenType()]

    def read_next(self) -> TokenTypeStr:
        """Read the next token and returns its type.

        Returns:
            token type
        """
        return TOKEN_TYPE.inverse[self.readNext()]

get_error() -> ErrorStr

Return file error status.

Source code in prettyqt\core\xmlstreamreader.py
def get_error(self) -> ErrorStr:
    """Return file error status.

    Returns:
        file error status
    """
    return ERROR.inverse[self.error()]

get_token_type() -> TokenTypeStr

Get the current token type.

Source code in prettyqt\core\xmlstreamreader.py
def get_token_type(self) -> TokenTypeStr:
    """Get the current token type.

    Returns:
        token type
    """
    return TOKEN_TYPE.inverse[self.tokenType()]

read_next() -> TokenTypeStr

Read the next token and returns its type.

Source code in prettyqt\core\xmlstreamreader.py
def read_next(self) -> TokenTypeStr:
    """Read the next token and returns its type.

    Returns:
        token type
    """
    return TOKEN_TYPE.inverse[self.readNext()]