[SR-Users] xmlops & XPath question

Daniel-Constantin Mierla miconda at gmail.com
Sat May 3 10:31:34 CEST 2014


This kind usage of xmlns in an xml doc is a hack done by SIMPLE WG 
breaking XML standard, because any ns has to use a prefix for each 
corresponding name. If you search on google, you will fine some 
discussions on the web (iirc, Inaki was there as well) - libxml2 devs 
said they don't want to break the xml standard to handle this case, 
probably they didn't change the mind meanwhile.

Anyhow, set a prefix for the namespace via xml_ns parameter and then use 
it in xpath

modparam("xmlops", "xml_ns", "di=urn:ietf:params:xml:ns:dialog-info")

$xml(u=>xpath:/di:dialog-info/di:dialog[1]/di:state/text())

Hope i remembered correctly, anyhow it is somewhere in this direction. 
If not, search on mailing list archive, the situation popped up few 
times around.

Cheers,
Daniel

On 03/05/14 09:49, Alex Balashov wrote:
> It's definitely namespace-related, because when I manually hack out 
> the namespace, it works fine!
>
>    $var(x) = $rb;
>    $var(x) = $(var(x){re.subst,/xmlns=\".+\"//});
>
>    $xml(u=>doc) = $var(x);
>
>    xlog("L_INFO", "State: 
> $xml(u=>xpath:/dialog-info/dialog[1]/state/text())\n");
>
> But I can't for the life of me figure out how to construct an XPath 
> expression that properly captures the 
> urn:ietf:params:xml:ns:dialog-info namespace.
>
>

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20140503/e86e6583/attachment.html>


More information about the sr-users mailing list