The following query with Zorba 3.0:
declare function local:json($nodes as node()*)
{
{
"name": string($nodes//compoundname/text()),
"description": $nodes//detaileddescription//*[local-name() ne "htmlonly"]/text()
}
};
let $xml := doc("ft_tokenizer.xml")/doxygen
let $json := local:json($xml)
return serialize($json, ())
Returns
0 libzorba_simplestore.3.0.0.dylib 0x0000000102b51977 _ZN5zorba16assertion_failedEPKcS1_iS1_ + 74
1 libzorba_simplestore.3.0.0.dylib 0x0000000102f9f99b _ZN5zorba11simplestore7XmlNode17compareInSameTreeEPKS1_S3_ + 497
2 libzorba_simplestore.3.0.0.dylib 0x0000000102fb2131 _ZNK5zorba11simplestore21StoreNodeSortIterator18ComparisonFunctionclEPKNS0_7XmlNodeES5_ + 25
3 libzorba_simplestore.3.0.0.dylib 0x0000000102fb2292 _ZSt21__unguarded_partitionIN9__gnu_cxx17__normal_iteratorIPPN5zorba11simplestore7XmlNodeESt6vectorIS5_SaIS5_EEEES5_NS3_21StoreNodeSortIterator18ComparisonFunctionEET_SD_SD_T0_T1_ + 60
4 libzorba_simplestore.3.0.0.dylib 0x0000000102fb1f62 _ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPPN5zorba11simplestore7XmlNodeESt6vectorIS5_SaIS5_EEEElNS3_21StoreNodeSortIterator18ComparisonFunctionEEvT_SD_T0_T1_ + 262
5 libzorba_simplestore.3.0.0.dylib 0x0000000102fb1f7d _ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPPN5zorba11simplestore7XmlNodeESt6vectorIS5_SaIS5_EEEElNS3_21StoreNodeSortIterator18ComparisonFunctionEEvT_SD_T0_T1_ + 289
6 libzorba_simplestore.3.0.0.dylib 0x0000000102fb1f7d _ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPPN5zorba11simplestore7XmlNodeESt6vectorIS5_SaIS5_EEEElNS3_21StoreNodeSortIterator18ComparisonFunctionEEvT_SD_T0_T1_ + 289
7 libzorba_simplestore.3.0.0.dylib 0x0000000102fb1170 _ZN5zorba11simplestore21StoreNodeSortIterator4nextERNS_5store10ItemHandleINS2_4ItemEEE + 536
8 libzorba_simplestore.3.0.0.dylib 0x0000000102dbc5e9 _ZNK5zorba16NodeSortIterator8nextImplERNS_5store10ItemHandleINS1_4ItemEEERNS_9PlanStateE + 21
9 libzorba_simplestore.3.0.0.dylib 0x0000000102c066af _ZN5zorba12PlanIterator11consumeNextERNS_5store10ItemHandleINS1_4ItemEEEPKS0_RNS_9PlanStateE + 31
10 libzorba_simplestore.3.0.0.dylib 0x0000000102cb3f16 _ZNK5zorba15JSONBoxIterator8nextImplERNS_5store10ItemHandleINS1_4ItemEEERNS_9PlanStateE + 98
11 libzorba_simplestore.3.0.0.dylib 0x0000000102c066af _ZN5zorba12PlanIterator11consumeNextERNS_5store10ItemHandleINS1_4ItemEEEPKS0_RNS_9PlanStateE + 31
12 libzorba_simplestore.3.0.0.dylib 0x0000000102e4bb9b _ZNK5zorba24JSONDirectObjectIterator8nextImplERNS_5store10ItemHandleINS1_4ItemEEERNS_9PlanStateE + 375
13 libzorba_simplestore.3.0.0.dylib 0x0000000102c066af _ZN5zorba12PlanIterator11consumeNextERNS_5store10ItemHandleINS1_4ItemEEEPKS0_RNS_9PlanStateE + 31
14 libzorba_simplestore.3.0.0.dylib 0x0000000102daa03d _ZNK5zorba5flwor13FLWORIterator8nextImplERNS_5store10ItemHandleINS2_4ItemEEERNS_9PlanStateE + 1373
15 libzorba_simplestore.3.0.0.dylib 0x0000000102c066af _ZN5zorba12PlanIterator11consumeNextERNS_5store10ItemHandleINS1_4ItemEEEPKS0_RNS_9PlanStateE + 31
16 libzorba_simplestore.3.0.0.dylib 0x0000000102c812a4 _ZNK5zorba21FunctionTraceIterator8nextImplERNS_5store10ItemHandleINS1_4ItemEEERNS_9PlanStateE + 62
17 libzorba_simplestore.3.0.0.dylib 0x0000000102c066af _ZN5zorba12PlanIterator11consumeNextERNS_5store10ItemHandleINS1_4ItemEEEPKS0_RNS_9PlanStateE + 31
18 libzorba_simplestore.3.0.0.dylib 0x0000000102d85477 _ZN5zorba19PlanIteratorWrapper4nextERNS_5store10ItemHandleINS1_4ItemEEE + 23
19 libzorba_simplestore.3.0.0.dylib 0x00000001028af9e7 _ZN5zorba10serializer9serializeENS_8rchandleINS_5store8IteratorEEERSoPNS_19SAX2_ContentHandlerEb + 237
20 libzorba_simplestore.3.0.0.dylib 0x00000001028af8cd _ZN5zorba10serializer9serializeENS_8rchandleINS_5store8IteratorEEERSob + 45
21 libzorba_simplestore.3.0.0.dylib 0x0000000102cef322 _ZNK5zorba19FnSerializeIterator8nextImplERNS_5store10ItemHandleINS1_4ItemEEERNS_9PlanStateE + 312
22 libzorba_simplestore.3.0.0.dylib 0x0000000102c066af _ZN5zorba12PlanIterator11consumeNextERNS_5store10ItemHandleINS1_4ItemEEEPKS0_RNS_9PlanStateE + 31
23 libzorba_simplestore.3.0.0.dylib 0x0000000102d85c2e _ZN5zorba11PlanWrapper4nextERNS_5store10ItemHandleINS1_4ItemEEE + 48
24 libzorba_simplestore.3.0.0.dylib 0x00000001028af9e7 _ZN5zorba10serializer9serializeENS_8rchandleINS_5store8IteratorEEERSoPNS_19SAX2_ContentHandlerEb + 237
error [zerr:ZXQP0002]: "false": assertion failed
However if the text() node is remove of the query:
declare function local:json($nodes as node()*)
{
{
"name": string($nodes//compoundname/text()),
"description": $nodes//detaileddescription//*[local-name() ne "htmlonly"]/string()
}
};
let $xml := doc("ft_tokenizer.xml")/doxygen
let $json := local:json($xml)
return serialize($json, ())
The query runs as expected