[Scilab-users] Extracting numerical an text data from gmx files

Jens Simon Strom j.s.strom at hslmg.de
Mon May 22 08:19:47 CEST 2017


Hello Samuel,

I tried the script

doc=xmlRead("G:/Daten/Navigation/gpxArchiv/testfile.gpx")
recent =getPreferencesValue("/gpx/rte/body/rtept", ["lat","lon"],doc)
xmlDelete(doc)

The file is as below.

The result is:
  doc  =
XML Document
url: file:///G:/Daten/Navigation/gpxArchiv/testfile.gpx
root: XML Element
  !--error 10000
getPreferencesValue: Invalid XPath request.
at line      39 of function getPreferencesValue called by :
recent = getPreferencesValue("/gpx/rte/rtept", ["lat","lon"],doc)
at line      55 of exec file called by :
exec('G:\Daten\Navigation\eTrex10_GPX_Generator.sce', -1)

What am I doing wrong here?
Regards, Jens
-----------------------------------------------------------------------------

Am 22.05.2017 01:31, schrieb Jens Simon Strom:
> Great, I will try this soon.
> Regards, Jens
> --------------------------------------------------------------------------
>
> Am 22.05.2017 01:14, schrieb Samuel Gougeon:
>> Hello,
>>
>> Le 22/05/2017 à 00:32, Jens Simon Strom a écrit :
>>> Hi,
>>> I want to extract lat, lon and <rte>-name from gmx files. See the 
>>> following reduced example:
>>> -----------------------------------------------------------------------------------------------------------------------------------------
>>> <?xml version="1.0" encoding="UTF-8" standalone="no" ?><gpx 
>>> xmlns="http://www.topografix.com/GPX/1/1" creator="MEDIA-TOURS" 
>>> version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
>>> xsi:schemaLocation="http://www.topografix.com/GPX/1/1 
>>> http://www.topografix.com/GPX/1/1/gpx.xsd">
>>> <!--
>>> line of comments
>>> ...
>>> line of comments
>>>  -->
>>> <rte>
>>> <name>route_1</name>
>>> <rtept lat="52.00424932154729" lon="8.875365257263184">
>>> <name>1 Start</name>
>>> </rtept>
>>> <rtept lat="52.00319255643224" lon="8.878369331359863">
>>> <name>11 station</name>
>>> </rtept>
>>> <rtept lat="52.00271700399025" lon="8.879871368408203">
>>> <name>111 destination.</name>
>>> </rtept>
>>> </rte>
>>> </gpx>
>>> ------------------------------------------------------------------------------------------------------------------------------------
>>> lat and lon  should be collected as numerical colum vectors, name as 
>>> a colum of strings.
>>>
>>> Which commands would you recommend? Is reading by mgetl and 
>>> retrieving by regexp recommendable?
>>
>> xmlXPath() is made for parsing xml documents and extracting selected 
>> informations.
>> getPreferencesValue() may also help. It is based on xmlXPath()
>>
>> HTH
>> Samuel
>>
>>
>>
>> _______________________________________________
>> users mailing list
>> users at lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20170522/9cf42462/attachment.htm>


More information about the users mailing list