Hi Daniel,

>> How is this actually supposed to work? What I'd like to do in the end is
>> extracting for example the "none" from the "basic"-tag by specifying
>> "xpath:/presence/tuple/status/basic", which also returns an empty string
>> now, also when appended with "/text()".
> the problem is in between IETF and XML guys :-)
> 
> xpath require to use a prefix for namespaces. The SIMPLE guys liked to
> set a default one without prefix.
> 
> For this case, try:
> 
> modparam("presence_xml", "xml_ns", "pidf=urn:ietf:params:xml:ns:pidf")
> 
> then:
> 
> xlog("L_INFO",
> "tmp2=$xml(x=>xpath:/pidf:presence/pidf:tuple/pidf:status/pidf:basic)\n");

Got it. But what if it gets a bit more difficult than that? :)

I've an xml document where the namespace for some elements changes, like
this:

<?xml version="1.0" encoding="utf-8"?>
<presence xmlns="urn:ietf:params:xml:ns:pidf" entity="sip:f...@mydomain.com">
  <tuple id="86ae65b7-42de-4399-b635-295caad13aac">
    <status>
      <basic>none</basic>
      <geopriv xmlns="urn:ietf:params:xml:ns:pidf:geopriv10">
        <location-info>
          <location xmlns="http://www.opengis.net/gml";>
[snip]

As you can see, the "geopriv" element changes the namespace from "pidf"
to "pidf:geopriv10". Even giving the full namespace
(".../urn:ietf:params:xml:ns:pidf:geopriv10:geopriv") to capture the
"geopriv" element results in

ERROR: presence_xml [pv_xml.c:310]: unable to evaluate xpath expression
[/pidf:presence/pidf:tuple/pidf:status/urn:ietf:params:xml:ns:pidf:geopriv10:geopriv/83]

Any ideas are highly appreciated :)

Andreas

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to