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@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@ims.mnc0xx.mccxxx.3gppnetwork.org"><dm:device id="Wifi">gp:geoprivgp:location-info<gs:Circle srsName="urn:ogc:def:crs:EPSG::5524">gml:pos31.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:methodDBH_HELO</gp:method>gp:usage-rules/</gp:geopriv>dm:timestamp2022-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
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@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@ims.mnc0xx.mccxxx.3gppnetwork.org"><dm:device id="Wifi">gp:geoprivgp:location-info<gs:Circle srsName="urn:ogc:def:crs:EPSG::5524">gml:pos31.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:methodDBH_HELO</gp:method>gp:usage-rules/</gp:geopriv>dm:timestamp2022-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@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@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@ims.mnc0xx.mccxxx.3gppnetwork.org"><dm:device id="Wifi">gp:geoprivgp:location-info<gs:Circle srsName="urn:ogc:def:crs:EPSG::5524">gml:pos31.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:methodDBH_HELO</gp:method>gp:usage-rules/</gp:geopriv>dm:timestamp2022-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
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@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@ims.mnc0xx.mccxxx.3gppnetwork.org"> <dm:device id="Wifi"> gp:geopriv gp:location-info <gs:Circle srsName="urn:ogc:def:crs:EPSG::5524"> gml:pos31.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:methodDBH_HELO</gp:method> gp:usage-rules/ </gp:geopriv> dm:timestamp2022-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@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@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@ims.mnc0xx.mccxxx.3gppnetwork.org"><dm:device id="Wifi">gp:geoprivgp:location-info<gs:Circle srsName="urn:ogc:def:crs:EPSG::5524">gml:pos31.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:methodDBH_HELO</gp:method>gp:usage-rules/</gp:geopriv>dm:timestamp2022-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@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@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@ims.mnc0xx.mccxxx.3gppnetwork.org"><dm:device id="Wifi">gp:geoprivgp:location-info<gs:Circle srsName="urn:ogc:def:crs:EPSG::5524">gml:pos31.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:methodDBH_HELO</gp:method>gp:usage-rules/</gp:geopriv>dm:timestamp2022-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
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@ims.mnc015.mcc302.3gppnetwork.org"> <dm:device id="Wifi"> gp:geopriv gp:location-info <gs:Circle srsName="urn:ogc:def:crs:EPSG::5524"> gml:pos31.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:methodDBH_HELO</gp:method> gp:usage-rules/ </gp:geopriv> dm:timestamp2022-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@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@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@ims.mnc0xx.mccxxx.3gppnetwork.org"> <dm:device id="Wifi"> gp:geopriv gp:location-info <gs:Circle srsName="urn:ogc:def:crs:EPSG::5524"> gml:pos31.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:methodDBH_HELO</gp:method> gp:usage-rules/ </gp:geopriv> dm:timestamp2022-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@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@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@ims.mnc0xx.mccxxx.3gppnetwork.org"><dm:device id="Wifi">gp:geoprivgp:location-info<gs:Circle srsName="urn:ogc:def:crs:EPSG::5524">gml:pos31.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:methodDBH_HELO</gp:method>gp:usage-rules/</gp:geopriv>dm:timestamp2022-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@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@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@ims.mnc0xx.mccxxx.3gppnetwork.org"><dm:device id="Wifi">gp:geoprivgp:location-info<gs:Circle srsName="urn:ogc:def:crs:EPSG::5524">gml:pos31.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:methodDBH_HELO</gp:method>gp:usage-rules/</gp:geopriv>dm:timestamp2022-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
It doesn't seem that element gml:pos is the root node, so the path to it has to contain the parent tags. See the xpath specs to understand betther how it has to be constructed.
Cheers, Daniel
On 06.04.22 10:14, Artur Hovsepyan wrote:
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@ims.mnc015.mcc302.3gppnetwork.org"> <dm:device id="Wifi"> gp:geopriv gp:location-info <gs:Circle srsName="urn:ogc:def:crs:EPSG::5524"> *gml:pos31.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:methodDBH_HELO</gp:method> gp:usage-rules/ </gp:geopriv> dm:timestamp2022-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@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@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@ims.mnc0xx.mccxxx.3gppnetwork.org"> <dm:device id="Wifi"> gp:geopriv gp:location-info <gs:Circle srsName="urn:ogc:def:crs:EPSG::5524"> gml:pos31.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:methodDBH_HELO</gp:method> gp:usage-rules/ </gp:geopriv> dm:timestamp2022-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@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=optional Content-ID: sip:+6478897789@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@ims.mnc0xx.mccxxx.3gppnetwork.org"> <dm:device id="Wifi"> gp:geopriv gp:location-info <gs:Circle srsName="urn:ogc:def:crs:EPSG::5524"> gml:pos31.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:methodDBH_HELO</gp:method> gp:usage-rules/ </gp:geopriv> dm:timestamp2022-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@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=optional Content-ID: sip:+6478897789@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@ims.mnc0xx.mccxxx.3gppnetwork.org"> <dm:device id="Wifi"> gp:geopriv gp:location-info <gs:Circle srsName="urn:ogc:def:crs:EPSG::5524"> gml:pos31.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:methodDBH_HELO</gp:method> gp:usage-rules/ </gp:geopriv> dm:timestamp2022-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
Kamailio - Users Mailing List - Non Commercial Discussions
- sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
hi Daniel,i have also tried to access like this, but still no luck: xinfo("status: $xml(x=>xpath:/pidf:presence/pidf:dm:device/pidf:gp:geopriv/pidf:gp:location-info/pidf:Circle/pidf:gml:pos)\n"); so i am not sure how do i access the gml_loc correctly. will appreciate if you give me an example of similar XML so i can use to get what i want to get. thanks
On Wednesday, April 6, 2022, 04:40:56 AM EDT, Daniel-Constantin Mierla miconda@gmail.com wrote:
It doesn't seem that element gml:pos is the root node, so the path to it has to contain the parent tags. See the xpath specs to understand betther how it has to be constructed.
Cheers, Daniel
I am trying different variants, but no luck:
xinfo("status: $xml(x=>xpath:/pidf:presence/pidf:dm:device/pidf:gp:geopriv/pidf:gp:location-info/pidf:gs:Circle/pidf:gml:pos)\n"); xinfo("GML_LOC: $xml(x=>xpath:/pidf:presence/pidf:dm:device/pidf:gp:geopriv/pidf:gp:location-info/pidf:gs:Circle/pidf:gml:pos)\n"); xinfo("GML_LOC: $xml(x=>xpath:/pidf:presence/dm:device/gp:geopriv/gp:location-info/gs:Circle/gml:pos)\n");
On Wednesday, April 6, 2022, 09:45:24 AM EDT, Artur Hovsepyan hvspa@yahoo.com wrote:
hi Daniel,i have also tried to access like this, but still no luck: xinfo("status: $xml(x=>xpath:/pidf:presence/pidf:dm:device/pidf:gp:geopriv/pidf:gp:location-info/pidf:Circle/pidf:gml:pos)\n"); so i am not sure how do i access the gml_loc correctly. will appreciate if you give me an example of similar XML so i can use to get what i want to get. thanks
On Wednesday, April 6, 2022, 04:40:56 AM EDT, Daniel-Constantin Mierla miconda@gmail.com wrote:
It doesn't seem that element gml:pos is the root node, so the path to it has to contain the parent tags. See the xpath specs to understand betther how it has to be constructed.
Cheers, Daniel