PythonQt.QtXmlPatterns.QXmlQuery · declarations 001
Back to PythonQt.QtXmlPatterns.QXmlQuery
QueryLanguage
instance-attribute
QueryLanguage: type
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.
int('0b100', base=0) 4
XmlSchema11IdentityConstraintField
instance-attribute
XmlSchema11IdentityConstraintField: QueryLanguage
XmlSchema11IdentityConstraintSelector
instance-attribute
XmlSchema11IdentityConstraintSelector: QueryLanguage
bindVariable
bindVariable(localName: Any, arg__2: Any) -> None
X.bindVariable(localName, arg__2)
Supplemental documentation: Qt 5 reference:
void QXmlQuery::bindVariable(const QXmlName \&name, const QXmlItem \&value)
Binds the variable name to the value so that $name can be used from within the query to refer to the value.
name must not be null. name.isNull() must return false. If name has already been bound by a previous bindVariable() call, its previous binding will be overridden.
If value is null so that value.isNull() returns true, and name already has a binding, the effect is to remove the existing binding for name.
To bind a value of type QString or QUrl, wrap the value in a QVariant such that QXmlItem's QVariant constructor is called.
All strings processed by the query must be valid XQuery strings, which means they must contain only XML 1.0 characters. However, this requirement is not checked. If the query processes an invalid string, the behavior is undefined.
See also QVariant::isValid(), How QVariant maps to XQuery's Data Model, and QXmlItem::isNull().
void QXmlQuery::bindVariable(const QString \&localName, const QXmlItem \&value)
This is an overloaded function.
This function constructs a QXmlName from localName using the query's namespace. The function then behaves as the overloaded function. It is equivalent to the following snippet.
QXmlNamePool namePool(query.namePool());
query.bindVariable(QXmlName(namePool, localName), value);
void QXmlQuery::bindVariable(const QXmlName \&name, QIODevice *device)
Binds the variable name to the device so that $name can be used from within the
query to refer to the device. The
QIODevice device is exposed to
the query as a URI of type xs:anyURI, which can be passed to the fn:doc() function
to be read. E.g., this function can be used to pass an XML document in memory to
fn:doc.
QByteArray myDocument;
QBuffer buffer(&myDocument); // This is a QIODevice.
buffer.open(QIODevice::ReadOnly);
QXmlQuery query;
query.bindVariable("myDocument", &buffer);
query.setQuery("doc($myDocument)");
The caller must ensure that device has been opened with at least QIODevice::ReadOnly prior to this binding. Otherwise, behavior is undefined.
If the query will access an XML document contained in a
QString, use a
QBuffer as shown in the following
snippet. Suppose myQString contains <document>content</document>
QBuffer device;
device.setData(myQString.toUtf8());
device.open(QIODevice::ReadOnly);
QXmlQuery query;
query.setQuery("doc($inputDocument)/query[theDocument]");
query.bindVariable("inputDocument", &device);
name must not be null. name.isNull() must return false. If name has already been bound, its previous binding will be overridden. The URI that name evaluates to is arbitrary and may change.
If the type of the variable binding changes (e.g., if a previous binding by the same
name was a QVariant, or if there was
no previous binding),
isValid() will return
false, and recompilation of the query text is required. To recompile the query, call
setQuery(). For this
reason, bindVariable() should be called before
setQuery(), if possible.
Note: device must not be deleted while this QXmlQuery exists.
void QXmlQuery::bindVariable(const QString \&localName, QIODevice *device)
This is an overloaded function.
If localName is a valid NCName, this function is equivalent to the following snippet.
QXmlNamePool namePool(query.namePool());
query.bindVariable(QXmlName(namePool, localName), device);
A QXmlName is constructed from localName, and is passed to the appropriate overload along with device.
See also QXmlName::isNCName().
void QXmlQuery::bindVariable(const QXmlName \&name, const QXmlQuery \&query)
Binds the result of the query query, to a variable by name name.
Evaluation of query will be commenced when this function is called.
If query is invalid, behavior is undefined. query will be copied.
This function was introduced in Qt 4.5.
See also isValid().
void QXmlQuery::bindVariable(const QString \&localName, const QXmlQuery \&query)
This is an overloaded function.
Has the same behavior and effects as the function being overloaded, but takes the variable name localName as a QString. query is used as in the overloaded function.
This function was introduced in Qt 4.5.
Upstream PySide2 reference signatures (binding differences may apply):
bindVariable(self, localName: str, arg__2: PySide2.QtCore.QIODevice) -> None
bindVariable(self, localName: str, query: PySide2.QtXmlPatterns.QXmlQuery) -> None
bindVariable(self, localName: str, value: PySide2.QtXmlPatterns.QXmlItem) -> None
bindVariable(self, name: PySide2.QtXmlPatterns.QXmlName, arg__2: PySide2.QtCore.QIODevice) -> None
bindVariable(self, name: PySide2.QtXmlPatterns.QXmlName, query: PySide2.QtXmlPatterns.QXmlQuery) -> None
bindVariable(self, name: PySide2.QtXmlPatterns.QXmlName, value: PySide2.QtXmlPatterns.QXmlItem) -> None
Source: https://doc.qt.io/archives/qt-5.15/qxmlquery.html#bindVariable
evaluateTo
evaluateTo(target: Any) -> bool
X.evaluateTo(target) -> bool
Supplemental documentation: Qt 5 reference:
void QXmlQuery::evaluateTo(QXmlResultItems *result) const
Starts the evaluation and makes it available in result. If result is null, the behavior is undefined. The evaluation takes place incrementally (lazy evaluation), as the caller uses QXmlResultItems::next() to get the next result.
See also QXmlResultItems::next().
bool QXmlQuery::evaluateTo(QAbstractXmlReceiver *callback) const
Evaluates this query and sends the result as a sequence of callbacks to the receiver callback. QXmlQuery does not take ownership of callback.
If an error occurs during the evaluation, error messages are sent to
messageHandler() and
false is returned.
If this query is invalid,
false is returned and the behavior is undefined. If callback is null, behavior is
undefined.
See also QAbstractXmlReceiver and isValid().
bool QXmlQuery::evaluateTo(QStringList *target) const
Attempts to evaluate the query and returns the results in the target string list.
If the query is valid and the evaluation succeeds, true is returned. Otherwise, false is returned and the contents of target are undefined.
The query must evaluate to a sequence of xs:string values. If the query does not
evaluate to a sequence of strings, the values can often be converted by adding a call to
string() at the end of the
XQuery.
If target is null, the behavior is undefined.
bool QXmlQuery::evaluateTo(QIODevice *target) const
Evaluates the query or stylesheet, and writes the output to target.
QXmlSerializer is used to write the output to target. In a future release, it is expected that this function will be changed to respect serialization options set in the stylesheet.
If an error occurs during the evaluation, error messages are sent to
messageHandler() and
false is returned.
If target is null, or is not opened in at least
QIODevice::WriteOnly
mode, the behavior is undefined.
QXmlQuery does not take ownership
of target.
This is an overloaded function.
This function was introduced in Qt 4.5.
bool QXmlQuery::evaluateTo(QString *output) const
Evaluates the query, and serializes the output as XML to output.
If an error occurs during the evaluation, error messages are sent to
messageHandler(),
the content of output is undefined and false is returned, otherwise true is
returned.
If output is null behavior is undefined.
QXmlQuery does not take ownership
of output.
Internally, the class QXmlFormatter is used for this.
This function was introduced in Qt 4.5.
Upstream PySide2 reference signatures (binding differences may apply):
evaluateTo(self, callback: PySide2.QtXmlPatterns.QAbstractXmlReceiver) -> bool
evaluateTo(self, result: PySide2.QtXmlPatterns.QXmlResultItems) -> None
evaluateTo(self, target: PySide2.QtCore.QIODevice) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qxmlquery.html#evaluateTo
initialTemplateName
initialTemplateName() -> Any
X.initialTemplateName() -> PythonQt.QtXmlPatterns.QXmlName
Supplemental documentation: Qt 5 reference:
QXmlName QXmlQuery::initialTemplateName() const
Returns the name of the XSL-T stylesheet template that the processor will call first when running an XSL-T stylesheet. This function only applies when using QXmlQuery to process XSL-T stylesheets. By default, no initial template is set. In that case, a default constructed QXmlName is returned.
This function was introduced in Qt 4.5.
See also setInitialTemplateName().
Upstream PySide2 reference signatures (binding differences may apply):
initialTemplateName(self) -> PySide2.QtXmlPatterns.QXmlName
Source: https://doc.qt.io/archives/qt-5.15/qxmlquery.html#initialTemplateName
isValid
isValid() -> bool
X.isValid() -> bool
Supplemental documentation: Qt 5 reference:
bool QXmlQuery::isValid() const
Returns true if this query is valid. Examples of invalid queries are ones that contain syntax errors or that have not had setQuery() called for them yet.
Upstream PySide2 reference signatures (binding differences may apply):
isValid(self) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qxmlquery.html#isValid
messageHandler
messageHandler() -> Any
X.messageHandler() -> PythonQt.QtXmlPatterns.QAbstractMessageHandler
Supplemental documentation: Qt 5 reference:
QAbstractMessageHandler *QXmlQuery::messageHandler() const
Returns the message handler that handles compile and runtime messages for this QXmlQuery.
See also setMessageHandler().
Upstream PySide2 reference signatures (binding differences may apply):
messageHandler(self) -> PySide2.QtXmlPatterns.QAbstractMessageHandler
Source: https://doc.qt.io/archives/qt-5.15/qxmlquery.html#messageHandler
namePool
namePool() -> Any
X.namePool() -> PythonQt.QtXmlPatterns.QXmlNamePool
Supplemental documentation: Qt 5 reference:
QXmlNamePool QXmlQuery::namePool() const
Returns the name pool used by this QXmlQuery for constructing names. There is no setter for the name pool, because mixing name pools causes errors due to name confusion.
Upstream PySide2 reference signatures (binding differences may apply):
namePool(self) -> PySide2.QtXmlPatterns.QXmlNamePool
Source: https://doc.qt.io/archives/qt-5.15/qxmlquery.html#namePool
networkAccessManager
networkAccessManager() -> Any
X.networkAccessManager() -> PythonQt.QtNetwork.QNetworkAccessManager
Supplemental documentation: Qt 5 reference:
QNetworkAccessManager *QXmlQuery::networkAccessManager() const
Returns the network manager, or 0 if it has not been set.
This function was introduced in Qt 4.5.
See also setNetworkAccessManager().
Source: https://doc.qt.io/archives/qt-5.15/qxmlquery.html#networkAccessManager
operator_assign
operator_assign(other: Any) -> Any
X.operator_assign(other) -> PythonQt.QtXmlPatterns.QXmlQuery
queryLanguage
queryLanguage() -> Any
X.queryLanguage()
Supplemental documentation: Qt 5 reference:
QXmlQuery::QueryLanguage QXmlQuery::queryLanguage() const
Returns a value indicating what this QXmlQuery is being used for. The default is QXmlQuery::XQuery10, which means the QXmlQuery is being used for running XQuery and XPath queries. QXmlQuery::XSLT20 can also be returned, which indicates the QXmlQuery is for running XSL-T spreadsheets.
This function was introduced in Qt 4.5.
Upstream PySide2 reference signatures (binding differences may apply):
queryLanguage(self) -> PySide2.QtXmlPatterns.QXmlQuery.QueryLanguage
Source: https://doc.qt.io/archives/qt-5.15/qxmlquery.html#queryLanguage
setFocus
setFocus(document: Any) -> bool
X.setFocus(document) -> bool
Supplemental documentation: Qt 5 reference:
void QXmlQuery::setFocus(const QXmlItem \&item)
Sets the focus to item. The focus is the set of items that the context item expression and path expressions navigate from. For example, in the expression p/span, the element that p evaluates to is the focus for the following expression, span.
The focus can be accessed using the context item expression, i.e., dot (".").
By default, the focus is not set and is undefined. It will therefore result in a dynamic
error, XPDY0002, if the focus is attempted to be accessed. The focus must be set
before the query is set with
setQuery().
There is no behavior defined for setting an item which is null.
bool QXmlQuery::setFocus(const QUrl \&documentURI)
This is an overloaded function.
Sets the focus to be the document located at documentURI and returns true. If documentURI cannot be loaded, false is returned. It is undefined at what time the document may be loaded. When loading the document, the message handler and URI resolver set on this QXmlQuery are used.
If documentURI is empty or is not a valid URI, the behavior of this function is undefined.
This function was introduced in Qt 4.5.
bool QXmlQuery::setFocus(QIODevice *document)
Sets the focus to be the document read from the QIODevice and returns true. If document cannot be loaded, false is returned.
QXmlQuery does not take ownership of document. The user guarantees that a document is available from the document device and that the document is not empty. The device must be opened in at least read-only mode. document must stay in scope as long as the current query is active.
This is an overloaded function.
This function was introduced in Qt 4.5.
bool QXmlQuery::setFocus(const QString \&focus)
This function behaves identically to calling the setFocus() overload with a QIODevice whose content is focus encoded as UTF-8. That is, focus is treated as if it contained an XML document.
Returns the same result as the overload.
This is an overloaded function.
This function was introduced in Qt 4.6.
Upstream PySide2 reference signatures (binding differences may apply):
setFocus(self, document: PySide2.QtCore.QIODevice) -> bool
setFocus(self, documentURI: PySide2.QtCore.QUrl) -> bool
setFocus(self, focus: str) -> bool
setFocus(self, item: PySide2.QtXmlPatterns.QXmlItem) -> None
Source: https://doc.qt.io/archives/qt-5.15/qxmlquery.html#setFocus
setInitialTemplateName
setInitialTemplateName(name: Any) -> None
X.setInitialTemplateName(name)
Supplemental documentation: Qt 5 reference:
void QXmlQuery::setInitialTemplateName(const QXmlName \&name)
Sets the name of the initial template. The initial template is the one the processor calls first, instead of attempting to match a template to the context node (if any). If an initial template is not set, the standard order of template invocation will be used.
This function only applies when using QXmlQuery to process XSL-T stylesheets. The name becomes part of the compiled stylesheet. Therefore, this function must be called before calling setQuery().
If the stylesheet has no template named name, the processor will use the standard order of template invocation.
This function was introduced in Qt 4.5.
See also initialTemplateName().
void QXmlQuery::setInitialTemplateName(const QString \&localName)
This is an overloaded function.
Sets the name of the initial template to localName, which must be a valid local name. The initial template is the one the processor calls first, instead of attempting to match a template to the context node (if any). If an initial template is not set, the standard order of template invocation will be used.
This function only applies when using QXmlQuery to process XSL-T stylesheets. The name becomes part of the compiled stylesheet. Therefore, this function must be called before calling setQuery().
If localName is not a valid local name, the effect is undefined. If the stylesheet has no template named localName, the processor will use the standard order of template invocation.
This function was introduced in Qt 4.5.
See also initialTemplateName().
Upstream PySide2 reference signatures (binding differences may apply):
setInitialTemplateName(self, name: PySide2.QtXmlPatterns.QXmlName) -> None
setInitialTemplateName(self, name: str) -> None
Source: https://doc.qt.io/archives/qt-5.15/qxmlquery.html#setInitialTemplateName
setMessageHandler
setMessageHandler(messageHandler: Any) -> None
X.setMessageHandler(messageHandler)
Supplemental documentation: Qt 5 reference:
void QXmlQuery::setMessageHandler(QAbstractMessageHandler *aMessageHandler)
Changes the message handler for this QXmlQuery to aMessageHandler. The query sends all compile and runtime messages to this message handler. QXmlQuery does not take ownership of aMessageHandler.
Normally, the default message handler is sufficient. It writes compile and runtime messages to stderr. The default message handler includes color codes if stderr can render colors.
Note that changing the message handler after the query has been compiled has no effect, i.e. the query uses the same message handler at runtime that it uses at compile time.
When QXmlQuery calls QAbstractMessageHandler::message(), the arguments are as follows:
| message() argument | Semantics |
|---|---|
| QtMsgType type | Only QtWarningMsg and QtFatalMsg are used. The former identifies a compile or runtime warning, while the latter identifies a dynamic or static error. |
| const QString \& description | An XHTML document which is the actual message. It is translated into the current language. |
| const QUrl \&identifier | Identifies the error with a URI, where the fragment is the error code, and the rest of the URI is the error namespace. |
| const QSourceLocation \& sourceLocation | Identifies where the error occurred. |
See also messageHandler().
Upstream PySide2 reference signatures (binding differences may apply):
setMessageHandler(self, messageHandler: PySide2.QtXmlPatterns.QAbstractMessageHandler) -> None
Source: https://doc.qt.io/archives/qt-5.15/qxmlquery.html#setMessageHandler
setNetworkAccessManager
setNetworkAccessManager(newManager: Any) -> Any
X.setNetworkAccessManager(newManager)
Supplemental documentation: Qt 5 reference:
void QXmlQuery::setNetworkAccessManager(QNetworkAccessManager *newManager)
Sets the network manager to newManager. QXmlQuery does not take ownership of newManager.
This function was introduced in Qt 4.5.
See also networkAccessManager().
Source: https://doc.qt.io/archives/qt-5.15/qxmlquery.html#setNetworkAccessManager
setQuery
setQuery(sourceCode: Any, documentURI: Any) -> None
X.setQuery(sourceCode, documentURI)
Supplemental documentation: Qt 5 reference:
void QXmlQuery::setQuery(QIODevice *sourceCode, const QUrl \&documentURI \= QUrl())
Sets this QXmlQuery to an XQuery read from the sourceCode device. The device must have been opened with at least QIODevice::ReadOnly.
documentURI represents the query obtained from the sourceCode device. It is the base URI of the static context, as defined in the XQuery language. It is used internally to resolve relative URIs that appear in the query, and for message reporting. documentURI can be empty. If it is empty, the application file path is used. If it is not empty, it may be either relative or absolute. If it is relative, it is resolved itself against the application file path before it is used. If documentURI is neither a valid URI nor empty, the result is undefined.
If the query contains a static error (e.g. syntax error), an error message is sent to the messageHandler(), and isValid() will return false.
Variables must be bound before setQuery() is called.
The encoding of the XQuery in sourceCode is detected internally using the rules for setting and detecting encoding of XQuery files, which are explained in the XQuery language.
If sourceCode is null or not readable, or if documentURI is not a valid URI,
behavior is undefined.
See also isValid().
void QXmlQuery::setQuery(const QString \&sourceCode, const QUrl \&documentURI \= QUrl())
This is an overloaded function.
The behavior and requirements of this function are the same as for setQuery(QIODevice*, const QUrl\&), after the XQuery has been read from the IO device into a string. Because sourceCode is already a Unicode string, detection of its encoding is unnecessary.
void QXmlQuery::setQuery(const QUrl \&queryURI, const QUrl \&baseURI \= QUrl())
Sets this QXmlQuery to the XQuery read from the queryURI. Use isValid() after calling this function. If an error occurred reading queryURI, e.g., the query does not exist, cannot be read, or is invalid, isValid() will return false.
The supported URI schemes are the same as those in the
XQuery function fn:doc,
except that queryURI can be the object of a variable binding.
baseURI is the Base URI of the static context, as defined in the XQuery language. It is used internally to resolve relative URIs that appear in the query, and for message reporting. If baseURI is empty, queryURI is used. Otherwise, baseURI is used, and it is resolved against the application file path if it is relative.
If queryURI is empty or invalid, or if baseURI is invalid, the behavior of this function is undefined.
Upstream PySide2 reference signatures (binding differences may apply):
setQuery(self, queryURI: PySide2.QtCore.QUrl, baseURI: PySide2.QtCore.QUrl=...) -> None
setQuery(self, sourceCode: PySide2.QtCore.QIODevice, documentURI: PySide2.QtCore.QUrl=...) -> None
setQuery(self, sourceCode: str, documentURI: PySide2.QtCore.QUrl=...) -> None
Source: https://doc.qt.io/archives/qt-5.15/qxmlquery.html#setQuery
setUriResolver
setUriResolver(resolver: Any) -> None
X.setUriResolver(resolver)
Supplemental documentation: Qt 5 reference:
void QXmlQuery::setUriResolver(const QAbstractUriResolver *resolver)
Sets the URI resolver to resolver. QXmlQuery does not take ownership of resolver.
See also uriResolver().
Upstream PySide2 reference signatures (binding differences may apply):
setUriResolver(self, resolver: PySide2.QtXmlPatterns.QAbstractUriResolver) -> None
Source: https://doc.qt.io/archives/qt-5.15/qxmlquery.html#setUriResolver
uriResolver
uriResolver() -> Any
X.uriResolver() -> PythonQt.QtXmlPatterns.QAbstractUriResolver
Supplemental documentation: Qt 5 reference:
const QAbstractUriResolver *QXmlQuery::uriResolver() const
Returns the query's URI resolver. If no URI resolver has been set, Qt XML Patterns will use the URIs in queries as they are.
The URI resolver provides a level of abstraction, or polymorphic URIs. A resolver can rewrite logical URIs to physical ones, or it can translate obsolete or invalid URIs to valid ones.
Qt XML Patterns calls the URI resolver for all URIs it encounters, except for
namespaces. Specifically, all builtin functions that deal with URIs (fn:doc(), and
fn:doc-available()).
In the case of fn:doc(), the absolute URI is the base URI in the static context (which
most likely is the location of the query). Rather than use the URI the user specified,
the return value of
QAbstractUriResolver::resolve()
will be used.
When Qt XML Patterns calls QAbstractUriResolver::resolve() the absolute URI is the URI mandated by the XQuery language, and the relative URI is the URI specified by the user.
See also setUriResolver().
Upstream PySide2 reference signatures (binding differences may apply):
uriResolver(self) -> PySide2.QtXmlPatterns.QAbstractUriResolver
Source: https://doc.qt.io/archives/qt-5.15/qxmlquery.html#uriResolver