comet.CXMLTree¶
- class comet.CXMLTree¶
Methods¶
- CXMLTree.getRoot()¶
Get the root node of this tree.
- Returns
The root node of this tree
- Return type
- Raises
CometError – On internal error
- Available
- CScript
- CXMLTree.send(command)¶
Send an XMLQuery command to this tree.
Subsequent calls to this function will not overwrite but extend the command.
Once
execute()
is called, the command is reset.- Parameters
command (str) – The command to send.
- Return type
- Raises
TypeError – When parameter types are invalid
CometError – On internal error
- Available
- CScript
- CXMLTree.sendCDataBegin()¶
Open a CData block in the XMLQuery command.
This is a convenience function doing the same as calling
send()
with the parameter ‘<![CDATA[’ .A once opened CData block must be closed again using
sendCDataEnd()
.In CData blocks, the string ‘![[[CDATA[’ must not be used!
- Return type
- Available
- CScript
- CXMLTree.sendCDataEnd()¶
Close a CData block in the XMLQuery command.
This is a convenience function doing the same as calling
send()
with the parameter ‘]]>’ .- Return type
- Available
- CScript
- CXMLTree.input(value)¶
Bind a value to a placeholder in the XMLQuery command.
The value is copied immediately to the command.
- Parameters
- Return type
- Raises
TypeError – When parameter types are invalid
CometError – On internal error
- Available
- CScript
- CXMLTree.output(types)¶
Bind output types to result columns of the XMLQuery command.
Since XML does not contain type information all result columns would usually be of type
str
. This function changes the result types in the resultexec()
. It is possible to call this function afterexec()
, but it must be called beforefetch()
.The first entry of the type list is the type of the first result, etc..
The value from the XML input must be convertible to the designated result type.
- Parameters
list[int]types –
The list of expected output types.
Allowed values and their corresponding output types:
- Return type
- Raises
TypeError – When parameter types are invalid
CometError – On internal error
- Available
- CScript
- CXMLTree.execute(showErrors=True)¶
Execute the XMLQuery command stored in this tree.
This resets the stored command.
- Parameters
showErrors (bool) –
Should the processing errors be displayed automatically?
True
Show errors in an error dialog.
False
Do not show errors in an error dialog. The script does the error handling itself.
A list of possible errors and their description can be found here .
Please note that warnings e.g. about missing attributes or elements are NOT considered as errors but only as warnings and therefore will not be seen by setting showErrors.
- Return type
- Raises
TypeError – When parameter types are invalid
CometError – On internal error
- Available
- CScript
- CXMLTree.fetch()¶
Fetch the result columns of the XMLQuery command executed by
exec()
.- Returns
The result of the query.
Each entry contains types according to the specification set by
output()
.- Return type
- Raises
CometError – On internal error
- Available
- CScript