[SR-Users] escape firt two lines from get_body_part to get xml only part
Artur Hovsepyan
hvspa at yahoo.com
Wed Apr 6 10:14:48 CEST 2022
i have managed to escape first two lines assuming their length is constant:
$var(pbody) = $(var(pbody){s.strip,115});defined the namespaces:
455 modparam("xmlops", "xml_ns", "pidf=urn:ietf:params:xml:ns:pidf")
456 modparam("xmlops", "xml_ns", "gp=urn:ietf:params:xml:ns:pidf:geopriv10")
457 modparam("xmlops", "xml_ns", "gs=http://www.opengis.net/pidflo/1.0")
458 modparam("xmlops", "xml_ns", "gml=http://www.opengis.net/gml")
now i am trying to access the namespace "gml" from xml document but no luck:
593 xinfo("GML_LOC: $xml(x=>xpath:/gml:pos)\n");
trying to get the position from XML document:
<?xml version="1.0"?>
<presence xmlns="urn:ietf:params:xml:ns:pidf" xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" xmlns:gp="urn:ietf:params:xml:ns:pidf:geopriv10" xmlns:gml="http://www.opengis.net/gml" xmlns:gs="http://www.opengis.net/pidflo/1.0" xmlns:con="urn:ietf:params:xml:ns:geopriv:conf" entity="sip:+16478897789 at ims.mnc015.mcc302.3gppnetwork.org">
<dm:device id="Wifi">
<gp:geopriv>
<gp:location-info>
<gs:Circle srsName="urn:ogc:def:crs:EPSG::5524">
<gml:pos>31.204359 -44.512358</gml:pos>
<gs:radius uom="urn:ogc:def:uom:EPSG::8190">10.578000</gs:radius>
</gs:Circle>
<con:confidence pdf="normal">92</con:confidence>
</gp:location-info>
<gp:method>DBH_HELO</gp:method>
<gp:usage-rules/>
</gp:geopriv>
<dm:timestamp>2022-04-05T19:16:34Z</dm:timestamp>
</dm:device>
</presence>
any ideas how to correctly define the gml namespace to be able to access the "pos" ?
thanks in advance,
On Wednesday, April 6, 2022, 03:18:32 AM EDT, Artur Hovsepyan <hvspa at yahoo.com> wrote:
sending third time the same message, if not formatted again, please excuse me and please let me know how to send so the message comes in formatted:
hello everyone,
i am trying to parse the xml from the message body: get_body_part("application/pidf+xml", "$var(pbody)"); and i am getting the following in my pbody var:
Content-Disposition: render;handling=optional
Content-ID: <sip:+6478897789 at ims.mnc0xx.mccxxx.3gppnetwork.org>
<?xml version="1.0"?>
<presence xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" xmlns:gp="urn:ietf:params:xml:ns:pidf:geopriv10" xmlns:gml="http://www.opengis.net/gml" xmlns:gs="http://www.opengis.net/pidflo/1.0" xmlns:con="urn:ietf:params:xml:ns:geopriv:conf" entity="sip:+6478897789 at ims.mnc0xx.mccxxx.3gppnetwork.org">
<dm:device id="Wifi">
<gp:geopriv>
<gp:location-info>
<gs:Circle srsName="urn:ogc:def:crs:EPSG::5524">
<gml:pos>31.204359 -44.512358</gml:pos>
<gs:radius uom="urn:ogc:def:uom:EPSG::8190">10.578000</gs:radius>
</gs:Circle>
<con:confidence pdf="normal">92</con:confidence>
</gp:location-info>
<gp:method>DBH_HELO</gp:method>
<gp:usage-rules/>
</gp:geopriv>
<dm:timestamp>2022-04-05T19:16:34Z</dm:timestamp>
</dm:device>
</presence>
how can i escape the first two lines in order to get the xml part of the content?
thanks in advance,
Art
On Wednesday, April 6, 2022, 03:16:51 AM EDT, Artur Hovsepyan <hvspa at yahoo.com> wrote:
not sure why my first post is not formatted, sending it second time to make sure if it comes formatted or not:
hello everyone, i am trying to parse the xml from the message body: get_body_part("application/pidf+xml", "$var(pbody)"); and i am getting the following in my pbody var: Content-Disposition: render;handling=optionalContent-ID: <sip:+6478897789 at ims.mnc0xx.mccxxx.3gppnetwork.org><?xml version="1.0"?><presence xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" xmlns:gp="urn:ietf:params:xml:ns:pidf:geopriv10" xmlns:gml="http://www.opengis.net/gml" xmlns:gs="http://www.opengis.net/pidflo/1.0" xmlns:con="urn:ietf:params:xml:ns:geopriv:conf" entity="sip:+6478897789 at ims.mnc0xx.mccxxx.3gppnetwork.org"><dm:device id="Wifi"><gp:geopriv><gp:location-info><gs:Circle srsName="urn:ogc:def:crs:EPSG::5524"><gml:pos>31.204359 -44.512358</gml:pos><gs:radius uom="urn:ogc:def:uom:EPSG::8190">10.578000</gs:radius></gs:Circle><con:confidence pdf="normal">92</con:confidence></gp:location-info><gp:method>DBH_HELO</gp:method><gp:usage-rules/></gp:geopriv><dm:timestamp>2022-04-05T19:16:34Z</dm:timestamp></dm:device></presence> how can i escape the first two lines in order to get the xml part of the content? thanks in advance,Art
On Wednesday, April 6, 2022, 03:07:34 AM EDT, Artur Hovsepyan <hvspa at yahoo.com> wrote:
hello everyone, i am trying to parse the xml from the message body: get_body_part("application/pidf+xml", "$var(pbody)"); and i am getting the following in my pbody var: Content-Disposition: render;handling=optionalContent-ID: <sip:+6478897789 at ims.mnc0xx.mccxxx.3gppnetwork.org><?xml version="1.0"?><presence xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" xmlns:gp="urn:ietf:params:xml:ns:pidf:geopriv10" xmlns:gml="http://www.opengis.net/gml" xmlns:gs="http://www.opengis.net/pidflo/1.0" xmlns:con="urn:ietf:params:xml:ns:geopriv:conf" entity="sip:+6478897789 at ims.mnc0xx.mccxxx.3gppnetwork.org"><dm:device id="Wifi"><gp:geopriv><gp:location-info><gs:Circle srsName="urn:ogc:def:crs:EPSG::5524"><gml:pos>31.204359 -44.512358</gml:pos><gs:radius uom="urn:ogc:def:uom:EPSG::8190">10.578000</gs:radius></gs:Circle><con:confidence pdf="normal">92</con:confidence></gp:location-info><gp:method>DBH_HELO</gp:method><gp:usage-rules/></gp:geopriv><dm:timestamp>2022-04-05T19:16:34Z</dm:timestamp></dm:device></presence> how can i escape the first two lines in order to get the xml part of the content? thanks in advance,Art
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220406/075e0ab6/attachment.htm>
More information about the sr-users
mailing list