<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hello Samuel,<br>
    Here comes a sucsessful result:<br>
    <pre style="font-family:Monospaced;font-style:normal;font-size:12.0;"><big><big><big>function [<span style="font-weight: bold;">route</span>, <span style="font-weight: bold;">lat</span>, <span style="font-weight: bold;">lon</span>, <span style="font-weight: bold;">n</span>]=<span style="text-decoration: underline;">gpx2scilab</span>(<span style="font-weight: bold;">gpxpath</span>)
    <span style="font-style: italic;">//Extracting geographical coordinates and route point names from a gpx file</span>
    <span style="font-style: italic;">//containing a route with routepoints as defined by the rte element</span>
    <span style="font-style: italic;">//gpxpath: full path of the gpx file (string 1 x 1). </span>
        <span style="font-style: italic;">//The first two lines of the file have to be</span>
            <span style="font-style: italic;">//</span><span style="font-style: italic;"><</span><span style="font-style: italic;">?xml version=</span><span style="font-style: italic;">"</span><span style="font-style: italic;">1.0</span><span style="font-style: italic;">"</span><span style="font-style: italic;"> encoding=</span><span style="font-style: italic;">"</span><span style="font-style: italic;">UTF-8</span><span style="font-style: italic;">"</span><span style="font-style: italic;"> standalone=</span><span style="font-style: italic;">"</span><span style="font-style: italic;">no</span><span style="font-style: italic;">"</span><span style="font-style: italic;"> ?</span><span style="font-style: italic;">></span>
            <span style="font-style: italic;">//</span><span style="font-style: italic;"><</span><span style="font-style: italic;">gpx ...</span><span style="font-style: italic;">></span>
         <span style="font-style: italic;">//The last line of the file has to be</span>
            <span style="font-style: italic;">//</span><span style="font-style: italic;"><</span><span style="font-style: italic;">/gpx</span><span style="font-style: italic;">></span>
     <span style="font-style: italic;">//route: All results compiled in a n x 4 string matrix</span>
     <span style="font-style: italic;">//lat: Geographical latitude/°  (numerical row vector))</span>
     <span style="font-style: italic;">//long: Geographical longitude/° (numerical row vector))</span>
     <span style="font-style: italic;">//n: number of route points</span>
     <span style="font-style: italic;">//gpx2scilab() requires Scilab Version 6.

</span>    doc=xmlRead(<span style="font-weight: bold;">gpxpath</span>);
    Coo=<span style="text-decoration: underline;">getPreferencesValue</span>("/gpx/rte/rtept", ["lat", "lon"],doc);<span style="font-style: italic;">//string matrix n x 2</span>
     xp = xmlXPath(doc, "/gpx/rte/rtept/name");<span style="font-style: italic;">//XMLSet</span>
     s = size(xp)
     Name=[]
     for i=1:s(2)
        Name=[Name;xmlDump(xp(i))]
     end
     xmlDelete(doc)
     <span style="font-weight: bold;">route</span>=[Name Coo string(1:s(2))']
     <span style="font-weight: bold;">lat</span>=strtod(Coo(:,1))<span style="font-style: italic;">//double, °</span>
     <span style="font-weight: bold;">lon</span>=strtod(Coo(:,2))<span style="font-style: italic;">//double, °</span>
     <span style="font-weight: bold;">n</span>=length(<span style="font-weight: bold;">lat</span>)<span style="font-style: italic;">//number of route points</span>
 endfunction</big></big></big></pre>
    Thanks again for your help.<br>
    <br>
    Regards, Jens<br>
______________________________________________________________________________<br>
    <br>
    <br>
    <div class="moz-cite-prefix">Am 22.05.2017 08:19, schrieb Jens Simon
      Strom:<br>
    </div>
    <blockquote cite="mid:59228303.4090704@hslmg.de" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      Hello Samuel,<br>
      <br>
      I tried the script <br>
      <pre style="font-style: normal; font-size: 13px;"><font face="Helvetica, Arial, sans-serif"><big><big>doc=xmlRead("G:/Daten/Navigation/gpxArchiv/testfile.gpx")
recent = <span style="text-decoration: underline;">getPreferencesValue</span>("/gpx/rte/body/rtept", ["lat","lon"],doc)<span style="font-style: italic;"></span>
xmlDelete(doc)</big></big></font></pre>
      The file is as below. <br>
      <br>
      The result is:<br>
       doc  = <br>
      XML Document<br>
      url: <a moz-do-not-send="true" class="moz-txt-link-freetext"
        href="file:///G:/Daten/Navigation/gpxArchiv/testfile.gpx">file:///G:/Daten/Navigation/gpxArchiv/testfile.gpx</a><br>
      root: XML Element<br>
       !--error 10000 <br>
      getPreferencesValue: Invalid XPath request.<br>
      at line      39 of function getPreferencesValue called by :  <br>
      recent = getPreferencesValue("/gpx/rte/rtept", ["lat","lon"],doc)<br>
      at line      55 of exec file called by :    <br>
      exec('G:\Daten\Navigation\eTrex10_GPX_Generator.sce', -1)<br>
      <br>
      What am I doing wrong here?<br>
      Regards, Jens<br>
-----------------------------------------------------------------------------<br>
       <br>
      <div class="moz-cite-prefix">Am 22.05.2017 01:31, schrieb Jens
        Simon Strom:<br>
      </div>
      <blockquote cite="mid:5922236B.2060601@hslmg.de" type="cite">
        <meta content="text/html; charset=ISO-8859-1"
          http-equiv="Content-Type">
        Great, I will try this soon.<br>
        Regards, Jens<br>
--------------------------------------------------------------------------<br>
        <br>
        <div class="moz-cite-prefix">Am 22.05.2017 01:14, schrieb Samuel
          Gougeon:<br>
        </div>
        <blockquote
          cite="mid:f4c32091-a21f-4dd8-4f74-528e585f31fe@free.fr"
          type="cite">
          <meta content="text/html; charset=ISO-8859-1"
            http-equiv="Content-Type">
          <div class="moz-cite-prefix">Hello,<br>
            <br>
            Le 22/05/2017 à 00:32, Jens Simon Strom a écrit :<br>
          </div>
          <blockquote cite="mid:59221585.7000204@hslmg.de" type="cite">
            <meta http-equiv="content-type" content="text/html;
              charset=ISO-8859-1">
            Hi,<br>
            I want to extract <font face="Courier New, Courier,
              monospace">lat</font>, <font face="Courier New, Courier,
              monospace">lon</font> and <font face="Courier New,
              Courier, monospace"><rte>-name</font> from gmx
            files. See the following reduced example:<br>
-----------------------------------------------------------------------------------------------------------------------------------------<br>
            <?xml version="1.0" encoding="UTF-8" standalone="no"
            ?><gpx xmlns=<a moz-do-not-send="true"
              class="moz-txt-link-rfc2396E"
              href="http://www.topografix.com/GPX/1/1">"http://www.topografix.com/GPX/1/1"</a>
            creator="MEDIA-TOURS" version="1.1" xmlns:xsi=<a
              moz-do-not-send="true" class="moz-txt-link-rfc2396E"
              href="http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/2001/XMLSchema-instance"</a>
            xsi:schemaLocation=<a moz-do-not-send="true"
              class="moz-txt-link-rfc2396E"
href="http://www.topografix.com/GPX/1/1http://www.topografix.com/GPX/1/1/gpx.xsd">"http://www.topografix.com/GPX/1/1



              http://www.topografix.com/GPX/1/1/gpx.xsd"</a>><br>
            <!-- <br>
            line of comments<br>
            ...<br>
            line of comments<br>
             --><br>
            <rte><br>
            <name>route_1</name><br>
            <rtept lat="52.00424932154729"
            lon="8.875365257263184"><br>
            <name>1 Start</name><br>
            </rtept><br>
            <rtept lat="52.00319255643224"
            lon="8.878369331359863"><br>
            <name>11 station</name><br>
            </rtept><br>
            <rtept lat="52.00271700399025"
            lon="8.879871368408203"><br>
            <name>111 destination.</name><br>
            </rtept><br>
            </rte><br>
            </gpx><br>
------------------------------------------------------------------------------------------------------------------------------------<br>
            <font face="Courier New, Courier, monospace">lat </font><font
              face="Courier New, Courier, monospace">and </font><font
              face="Courier New, Courier, monospace">lon</font>  should
            be collected as numerical colum vectors,  <font
              face="Courier New, Courier, monospace">name </font>as a
            colum of strings. <br>
            <br>
            Which commands would you recommend? Is reading by <font
              face="Helvetica, Arial, sans-serif">mgetl</font> and
            retrieving by <font face="Helvetica, Arial, sans-serif">regexp</font>
            recommendable?<br>
          </blockquote>
          <br>
          xmlXPath() is made for parsing xml documents and extracting
          selected informations.<br>
          getPreferencesValue() may also help. It is based on xmlXPath()<br>
          <br>
          HTH<br>
          Samuel<br>
          <br>
          <br>
          <fieldset class="mimeAttachmentHeader"></fieldset>
          <br>
          <pre wrap="">_______________________________________________
users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
        </blockquote>
        <br>
      </blockquote>
      <br>
    </blockquote>
    <br>
  </body>
</html>