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@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