I'd like to pull out the data for some of the elements stick the data into an array and then do stuff (graphs, mapping a route)
I've been looking at Dom and Xom but they have examples that are too simple. My question is what would be the best parser to use and a pointer to a good tutorial.
For beginners the best parser is the one built into Java. Don't waste your time downloading other parsers and figuring out how to make your code use them, just get going with a parser you already have.
I'm not going to suggest any tutorials. Apparently you have looked at some and rejected them. I don't know which ones those were so I can't suggest something else. But "too simple" is a wrong criterion. You do need to start with something simple before going on to more complex tasks.
Joined: Aug 23, 2010
Maybe too simple is the wrong term. There are examples with code and an XML file. The problem with the ones I've found so far it's kind of hard to understand what the code is doing. I've used one of the examples to successfully fish out the data I need using dom, but I don't totally understand what It's doing. I guess I need to read the api docs and brush up on my xml terms.
Can you be more specific as to what issues you're having understanding the tutorials? It's a fixed-format and shouldn't be particularly difficult to parse (I've done it, in fact, in three languages; I <3 my Garmins).
Joined: Aug 23, 2010
I understand what's going on now. Now that I know how to fish the data out I can go an learn how to use it to do some graph drawing, mapping etc..
This little project is going to be a personal workout tracker. I'm just going to use the garmin training center to get the xml file for now.
In the future I want to figure out how to talk to the Garmin directly to get the data. I have a Garmin forerunner 305 and a edge 305 (bike). Good learning project.
I was thinking about doing this in Cocoa/Obj-c as well.
I used DOM...here's the code:
Yeah, DOM code is kind of obscure. And even when you have it right, it's still ugly code. I try to avoid it as much as possible, but it's still good training for beginners, just to get the idea of how an XML document is structured.
Personally I prefer to apply XSLT, rather than Java, to my Garmin files. But that's a whole other language so I'm not going to make that a recommendation. Not yet anyway.