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)
Cheers,
Daniel
On 2/27/12 8:50 PM, Olle E. Johansson wrote:
Friends,
I'm having issues with the xpath support. If I run Daniel's example in the
XMLOPS, xpath works as documented. But if I take the
body of a PUBLISH from the and run xpath, I don't get expected results. Now, I'm
no XPATH guru so I may be totally off the markup here...
Here's the test script:
$xml(pub=>doc) = $rb;
$var(contact)=$xml(pub=>xpath:registration/contact@event);
xlog("--- Publish contact $var(contact) \n");
xlog("--- Publish aor $xml(pub=>xpath:registration@aor) \n");
xlog("--- Publish aor: $xml(pub=>xpath://@aor) \n");
xlog("--- Publish reg state: $xml(pub=>xpath://reginfo@state)
\n");
xlog("--- Publish uri: $xml(pub=>xpath:contact/uri/text()) \n");
I've tested with various paths, orginating from /reginfo or just picking an
attribute.
Here's the XML from Carsten's PUA_REGINFO module:
<?xml version="1.0"?>
<reginfo xmlns="urn:ietf:params:xml:ns:reginfo" version="0"
state="full">
<registration aor="sip:oej@testnamn.se" id="0x80590a590"
state="terminated"/>
</reginfo>
I wonder if it's something with using the request body that doesn't parse
properly in the XMLOPS module?
Error messages are a series of "XPath error : Invalid expression"
/O
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users(a)lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users