Actions
Bug #5070
closedCore dump calling declare_namespace
Start date:
2021-08-27
Due date:
% Done:
100%
Estimated time:
Found in version:
1.2.1
Fixed in version:
11.1
Platforms:
Description
My environment is a homebrew Python3 (3.9); I installed Cython (not sure of the version), and built as per the instructions.
The version of Saxon/C is 1.2.1 HE and/or EE.
#!/usr/bin/env python3
import os
import sys
cnlDir = os.path.dirname(os.path.realpath(__file__))
SAXONC_HOME = os.path.abspath(cnlDir + '/../tools/saxonc')
SAXONC_PYHOME = SAXONC_HOME + '/Saxon.C.API/python-saxon/'
sys.path.append(SAXONC_PYHOME)
os.environ['SAXONC_HOME'] = SAXONC_HOME
import saxonc
if __name__ == '__main__':
xdocPath = os.path.abspath(os.path.expanduser(sys.argv[1]))
with saxonc.PySaxonProcessor() as saxp:
xpath = saxp.new_xpath_processor()
xpath.declare_namespace('uncle', 'http://apple.com/ns/bob/uncle')
xdoc = saxp.parse_xml(xml_file_name=xdocPath)
xpath.set_context(xdm_item=xdoc)
results = xpath.evaluate('.//*:decTree[@spec]')
print(f'Num results: {results.size}')
for II in range(results.size):
repr = str(results.item_at(II).get_node_value())
print(repr.split('\n')[0])
Please register to edit this issue
Actions