PythonQt.Qt.QAbstractXmlReceiver
QAbstractXmlReceiver
PythonQtInstanceWrapper object
Native bases: PythonQtInstanceWrapper
Supplemental documentation: Qt 5 reference:
Detailed Description
QAbstractXmlReceiver is an abstract base class that provides a callback interface for receiving an XQuery sequence, usually the output of an QXmlQuery, and transforming that sequence into a structure of your choosing, usually 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 XML
serializer with the
query and
myOutputDevice (Note the
serializer is an XML
receiver, ie a subclass of QAbstractXmlReceiver). 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.
Although the example uses QXmlQuery to produce the sequence of callbacks to functions in QAbstractXmlReceiver, you can call the callback functions directly as long as your sequence of calls represents a valid XQuery sequence.
XQuery Sequences
An XQuery sequence is an ordered collection of zero, one, or many items. Each item is either an atomic value or a node. An atomic value is a simple data value.
There are six kinds of nodes.
- An Element Node represents an XML element.
- An Attribute Node represents an XML attribute.
- A Document Node represents an entire XML document.
- A Text Node represents character data (element content).
- A Processing Instruction Node represents an XML processing instruction, which is used in an XML document to tell the application reading the document to perform some action. A typical example is to use a processing instruction to tell the application to use a particular XSLT stylesheet to display the document.
- And a Comment node represents an XML comment.
The sequence of nodes and atomic values obeys the following rules. Note that Namespace Node refers to a special Attribute Node with name xmlns.
- Each node appears in the sequence before its children and their descendants appear.
- A node's descendants appear in the sequence before any of its siblings appear.
- A Document Node represents an entire document. Zero or more Document Nodes can appear in a sequence, but they can only be top level items (i.e., a Document Node can't be a child of another node.
- Namespace Nodes immediately follow the Element Node with which they are associated.
- Attribute Nodes immediately follow the Namespace Nodes of the element with which they are associated, or...
- If there are no Namespace Nodes following an element, then the Attribute Nodes immediately follow the element.
- An atomic value can only appear as a top level item, i.e., it can't appear as a child of a node.
- Processing Instruction Nodes do not have children, and their parent is either a Document Node or an Element Node.
- Comment Nodes do not have children, and their parent is either a Document Node or an Element Node.
The sequence of nodes and atomic values is sent to an QAbstractXmlReceiver (QXmlSerializer in the example above) as a sequence of calls to the receiver's callback functions. The mapping of callback functions to sequence items is as follows.
- startDocument() and endDocument() are called for each Document Node in the sequence. endDocument() is not called until all the Document Node's children have appeared in the sequence.
- startElement() and endElement() are called for each Element Node. endElement() is not called until all the Element Node's children have appeared in the sequence.
- attribute() is called for each Attribute Node.
- comment() is called for each Comment Node.
- characters() is called for each Text Node.
- processingInstruction() is called for each Processing Instruction Node.
- namespaceBinding() is called for each Namespace Node.
- atomicValue() is called for each atomic value.
For a complete explanation of XQuery sequences, visit XQuery Data Model.
Source: https://doc.qt.io/archives/qt-5.15/qabstractxmlreceiver.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 |
This callback is called when an atomic value appears in the [sequence](https://doc.qt.io/archives/qt-5.15/qabstractxmlreceiver.html#xquery-sequence). (shared captured text) |
attribute |
function | (self, name: Any, value: str) -> None |
X.attribute(name, value) (shared captured text) |
characters |
function | (self, value: str) -> None |
This callback is called when a text node appears in the [sequence](https://doc.qt.io/archives/qt-5.15/qabstractxmlreceiver.html#xquery-sequence). (shared captured text) |
className |
function | (self, *args: Any, **kwargs: Any) -> Any |
Return the classname of the object (shared captured text) |
comment |
function | (self, value: str) -> None |
This callback is called when a comment node appears in the [sequence](https://doc.qt.io/archives/qt-5.15/qabstractxmlreceiver.html#xquery-sequence). (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 |
This callback is called when the end of a document node appears in the [sequence](https://doc.qt.io/archives/qt-5.15/qabstractxmlreceiver.html#xquery-sequence). (shared captured text) |
endElement |
function | (self) -> None |
This callback is called when the end of an element node appears in the [sequence](https://doc.qt.io/archives/qt-5.15/qabstractxmlreceiver.html#xquery-sequence). (shared captured text) |
endOfSequence |
function | (self) -> None |
This callback is called once only, right after the [sequence](https://doc.qt.io/archives/qt-5.15/qabstractxmlreceiver.html#xquery-sequence) ends. (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, name: Any) -> None |
This callback is called when a namespace binding is in scope of an element. (shared captured text) |
processingInstruction |
function | (self, target: Any, value: str) -> None |
X.processingInstruction(target, value) (shared captured text) |
startDocument |
function | (self) -> None |
This callback is called when a document node appears in the [sequence](https://doc.qt.io/archives/qt-5.15/qabstractxmlreceiver.html#xquery-sequence). (shared captured text) |
startElement |
function | (self, name: Any) -> None |
This callback is called when a new element node appears in the [sequence](https://doc.qt.io/archives/qt-5.15/qabstractxmlreceiver.html#xquery-sequence). name is the valid… (shared captured text) |
startOfSequence |
function | (self) -> None |
This callback is called once only, right before the [sequence](https://doc.qt.io/archives/qt-5.15/qabstractxmlreceiver.html#xquery-sequence) begins. (shared captured text) |
whitespaceOnly |
function | (self, value: str) -> None |
(shared captured text) |