27 feb 2012 kl. 21:07 skrev Daniel-Constantin Mierla:
Hello,
an xpath invalid expression should be printed when the xpath expression is incorrect -- I
cannot say what is wrong, not being an xpath expert by hart.
However, there is a mismatching between the xml standards and SIP/SIMPLE specs. In XML,
the namespaces are bound to prefixes, while the guys at IETF added by their own so called
default namespace, which has no prefix for it. That results in not being able to use
directly xpath from libxml2 with SIMPLE bodies.
There were some discussions out there (you can google, iirc Inaki was in couple of them),
in one side, the devs of libxml2 said they don't want to break XML standards by
allowing bogus xpath queries with such namespaces. The workaround is to define xmlns
prefix in xmlops module:
http://kamailio.org/docs/modules/devel/modules/xmlops.html#xml_ns
modparam("xmlops", "xml_ns",
"ri=urn:ietf:params:xml:ns:reginfo")
and try:
$xml(pub=>xpath://ri:reginfo/ri:registration@aor)
Thanks!
The weird part is that I after adding that modparam get this error message:
loading modules under
/usr/local/lib64/kamailio/modules_k/:/usr/local/lib64/kamailio/modules/
0(65556) ERROR: <core> [modparam.c:162]: set_mod_param_regex: No module matching
<xmlops> found
0(65556) : <core> [cfg.y:3504]: parse error in config file kam-modules.inc, line
86, column 65: Can't set module parameter
This is on FreeBSD.
If I raise the debug I see the module being loaded and that it registers PVs
0(63596) DEBUG: <core> [mem/q_malloc.c:369]: qm_malloc(0x800c00000, 40) called from
xmlops: pv_xml.c: pv_parse_xml_name(448)
Weird stuff.
Kamailio 3.2.2
/O