Skip to content

PythonQt.Qt.QXmlSerializer

QXmlSerializer

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

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:

  • Declare namespaces when needed,
  • Use appropriate escaping, when characters can't be represented in the XML,
  • Handle line endings appropriately,
  • Report errors, when it can't serialize the content, e.g., when asked to serialize an attribute that is a top-level node, or when more than one top-level element is encountered.

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.

Source: https://doc.qt.io/archives/qt-5.15/qxmlserializer.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
atomicValue function (self, value: Any) -> None Reimplements: [QAbstractXmlReceiver::atomicValue](https://doc.qt.io/archives/qt-5.15/qabstractxmlreceiver.html#atomicValue)(const QVariant \&value). (shared captured text)
attribute function (self, name: Any, value: str) -> None X.attribute(name, value) (shared captured text)
characters function (self, value: str) -> None Reimplements: [QAbstractXmlReceiver::characters](https://doc.qt.io/archives/qt-5.15/qabstractxmlreceiver.html#characters)(const QStringRef \&value). (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
codec function (self) -> Any X.codec() -> PythonQt.QtCore.QTextCodec (shared captured text)
comment function (self, value: str) -> None Reimplements: [QAbstractXmlReceiver::comment](https://doc.qt.io/archives/qt-5.15/qabstractxmlreceiver.html#comment)(const QString \&value). (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
endDocument function (self) -> None Reimplements: [QAbstractXmlReceiver::endDocument](https://doc.qt.io/archives/qt-5.15/qabstractxmlreceiver.html#endDocument)(). (shared captured text)
endElement function (self) -> None Reimplements: [QAbstractXmlReceiver::endElement](https://doc.qt.io/archives/qt-5.15/qabstractxmlreceiver.html#endElement)(). (shared captured text)
endOfSequence function (self) -> None Reimplements: [QAbstractXmlReceiver::endOfSequence](https://doc.qt.io/archives/qt-5.15/qabstractxmlreceiver.html#endOfSequence)(). (shared captured text)
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
namespaceBinding function (self, nb: Any) -> None Reimplements: [QAbstractXmlReceiver::namespaceBinding](https://doc.qt.io/archives/qt-5.15/qabstractxmlreceiver.html#namespaceBinding)(const QXmlName \&name). (shared captured text)
outputDevice function (self) -> Any X.outputDevice() -> PythonQt.QtCore.QIODevice (shared captured text)
processingInstruction function (self, name: Any, value: str) -> None X.processingInstruction(name, value) (shared captured text)
setCodec function (self, codec: Any) -> None Sets the codec the serializer will use for encoding its XML output. (shared captured text)
startDocument function (self) -> None Reimplements: [QAbstractXmlReceiver::startDocument](https://doc.qt.io/archives/qt-5.15/qabstractxmlreceiver.html#startDocument)(). (shared captured text)
startElement function (self, name: Any) -> None Reimplements: [QAbstractXmlReceiver::startElement](https://doc.qt.io/archives/qt-5.15/qabstractxmlreceiver.html#startElement)(const QXmlName \&name). (shared captured text)
startOfSequence function (self) -> None Reimplements: [QAbstractXmlReceiver::startOfSequence](https://doc.qt.io/archives/qt-5.15/qabstractxmlreceiver.html#startOfSequence)(). (shared captured text)
whitespaceOnly function (self, value: Any) -> Any (shared captured text)