0

I have various cases in my document, for example one could read:

 <trkpt lat="59.329816021674275" lon="18.070487026335239" />

Other line can be:

 <trkpt lon="18.062546" lat="59.334781">

I need to get only latitude and longitude values between qutoes. I was searching for indexes of 'lat' and 'lon' and then extract only values until ".

Can someone provide simpler solution using Android (Java)?

unipin
  • 259
  • 1
  • 3
  • 13
  • 1
    that looks like XML. You need to parse XML – Vladyslav Matviienko Apr 08 '18 at 17:09
  • It's actually .gpx file from Anroid application. – unipin Apr 08 '18 at 17:10
  • See also [this](https://stackoverflow.com/questions/3495052/gpx-parser-for-java), [this](https://github.com/himanshu-soni/gpx-parser), and lots of other things found by [a search on `java parse gpx`](https://duckduckgo.com/?q=java+parse+gpx). – CommonsWare Apr 08 '18 at 17:13
  • @CommonsWare that was not the question. I was looking for how to get those specific values. I tried those GPX parsers and none of them works with my file. So I need to parse it on my own. – unipin Apr 08 '18 at 17:53
  • "So I need to parse it on my own" -- then parse it with an XML parser. – CommonsWare Apr 08 '18 at 18:15
  • Thank you so much @CommonsWare, it's working perfectly! Didn't know about Android XML Parser, I learnt something new. – unipin Apr 08 '18 at 18:53

0 Answers0