Project

Profile

Help

Error: "declareNameSpace not found" with the EE Licence

Added by Raik Müller over 1 year ago

Forum Eintrag Saxon

Hello,

I am currently working with the Saxon Library to evaluate xPaths.

I started with the Saxon HE Version but came fast to limitations since I needed to use the “declare_namespace” Method in Python.

So I switched to the EE Version and saved the license key in “/usr/local/lib/“ + changed the path to “libsaxoneec.dylib”

The tested after the change with the same code and it still works except the same method is missing (PyXPathProcessor):

"Error: /usr/local/lib/libsaxoneec.dylib.declareNameSpace not found"

I tested the same method from the “PyXQueryProcessor” Class and there it works.

My code:

import sys
sys.path.append("/Volumes/Macintosh HDD/Benutzer/RaikMueller/libsaxon-EEC-mac-setup-v1.2.1/Saxon.C.API/python-saxon")
from saxonc import *
import saxonc


example_path = """//recordTarget[dateTime(xs:date(patientRole/patient/birthTime/@value/string-join((if(substring(.,1,5)!="") then (substring(.,1,4)) else ("1970"),if(substring(.,5,2)!="") then (substring(.,5,2)) else ("01"),if(substring(.,7,2)!="") then (substring(.,7,2)) else ("01")),"-")),xs:time(patientRole/patient/birthTime/@value/string-join((if(substring(.,9,2)!="") then (substring(.,9,2)) else ("00"),if(substring(.,11,2)!="") then (substring(.,11,2)) else ("00"),if(substring(.,13,2)!="") then (substring(.,13,2)) else ("00")),":"))) < xs:dateTime("2012-12-23T00:00:00+01:00")]"""
example_path_2 = """//recordTarget[number(substring(patientRole/patient/birthTime/@value,1,4)) < 2015]/patientRole/patient/birthTime/@value"""

with saxonc.PySaxonProcessor(license=True) as proc:
    print("Test Python")
    print(proc.version)

    xsltproc = proc.new_xslt_processor()
    xp = proc.new_xpath_processor()
    xp.declare_namespace("xsi", "http://www.w3.org/2001/XMLSchema-instance")
    xp.set_context(file_name="resources/ELGA-023-Entlassungsbrief_aerztlich_EIS-FullSupport.xml")
    item = xp.evaluate(example_path)

    print(item)

OUTPUT:

Test Python Saxon/C 1.2.1 running with Saxon-EE 9.9.1.5C from Saxonica Error: /usr/local/lib/libsaxoneec.dylib.declareNameSpace not found

value="19611224"

Does anybody has an idea how to fix that problem?


Replies (3)

Please register to reply

RE: Error: "declareNameSpace not found" with the EE Licence - Added by O'Neil Delpratt over 1 year ago

Hi,

There is a bug in the XPathProcessor.cpp file in the declareNamespace method. It has incorrect method signature in the JNI. See line 254:

		(jmethodID) SaxonProcessor::sxn_environ->env->GetMethodID(cppClass, "declareNamespace",
				"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");

Replace with the following code:

		(jmethodID) SaxonProcessor::sxn_environ->env->GetMethodID(cppClass, "declareNamespace",
				"(Ljava/lang/String;Ljava/lang/String;)V");

Then rebuild the python library.

Raising a bug against it to commit in the next release

RE: Error: "declareNameSpace not found" with the EE Licence - Added by Raik Müller over 1 year ago

Thank you very much. Now it works perfectly!

    (1-3/3)

    Please register to reply