[SR-Users] xmlops & XPath question

Alex Balashov abalashov at evaristesys.com
Sat May 3 09:10:04 CEST 2014


Hello,

I don't know a lot about XML or XPath, so I was hoping someone could 
help me out.

I'm trying to parse out 'Event: dialog' state notifications from NOTIFYs 
using xmlops. They look like this:

<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="5" 
state="full" entity="sip:abalashov-roaming at xxx.xxx.xxx.xxx">
<dialog id="0588e460-d293-11e3-8563-538b9e69fee5" direction="initiator">
<state>terminated</state>
</dialog>
</dialog-info>

So, I do:

    $xml(u=>doc) = $rb;

    xlog("L_INFO", "State: 
$xml(u=>xpath:/dialog-info/dialog[1]/state/text())\n");

This produces a blank result. I've tried numerous other variations, such as:

    xpath:/dialog-info/dialog/state/text()

None of them work, either. When I upload the above XML body to various 
online XPath validation tools and try my expressions, they work fine.

Any ideas as to what I'm missing? Do I need to indicate the namespace in 
the XPath expression somehow? If so, how do I do it?

Thanks!

-- Alex

-- 
Alex Balashov - Principal
Evariste Systems LLC
235 E Ponce de Leon Ave
Suite 106
Decatur, GA 30030
United States
Tel: +1-678-954-0670
Web: http://www.evaristesys.com/, http://www.alexbalashov.com/



More information about the sr-users mailing list