Bug #6333
openRepresenting empty sequence
0%
Description
SaxonC currently does not properly represent empty sequences via the API. What we need is an XdmEmptySequence
class similar to its Java counterpart. Moreover, In SaxonJ (Java) an empty XdmValue
is also an empty sequence which can be passed as a parameter to an expression of stylesheet, but this fails in SaxonC.
For example:
xp = saxonproc.new_xpath_processor()
xp.declare_namespace("fn", "http://www.w3.org/2005/xpath-functions")
xp.declare_variable('p')
xdm_value = PyXdmValue()
xp.set_parameter('p', xdm_value)
assert xp.effective_boolean_value("fn:empty($p)")
Crashes out with the following exception:
java.lang.IllegalArgumentException: Invalid handle
at com.oracle.svm.core.handles.ObjectHandlesImpl.doGet(ObjectHandlesImpl.java:232)
at com.oracle.svm.core.handles.ObjectHandlesImpl.get(ObjectHandlesImpl.java:220)
at net.sf.saxon.option.cpp.ProcessorDataAccumulator.addProcessorDataPair(ProcessorDataAccumulator.java:93)
This is probably because the empty PyXdmValue()
object is not internally getting converted to an empty sequence.
Related issues
Updated by O'Neil Delpratt 3 months ago
The example result = xp.evaluate_single("(1,2,3)[10]")
in SaxonC Python currently returns None
because the result is an empty sequence. In Java this would be XdmEmptySequence
.
Updated by O'Neil Delpratt 3 months ago
- Related to Bug #6327: TypeError: __str__ returned non-string (type NoneType) added
Updated by O'Neil Delpratt 3 months ago
- Status changed from New to In Progress
Committed a partial fix to solve the Invalid handle
error. We now handle the empty PyXdmValue()
as an empty sequence.
Please register to edit this issue