| Author |
Topic |
 Lienzi |
Posted - 2010.11.19 19:18:00 - [ 1]
I've asked this here before, I thought I understood it but I don't. The EVE API XML Data seems to be a bit more complicated than some simple XML with just tags and text.
I'm wondering how, in java does one loop through the XML to print the whole tree. So, getting child nodes until reaching the attribute....without having to write 50 if then for loops each time you go further down the tree... I'm still new with coding. |
 Catari Taga Centre Of Attention Middle of Nowhere |
Posted - 2010.11.19 19:55:00 - [ 2]
At that level you should really consider using one of the free Java API libraries. Otherwise just google "java xml"... |
 Lienzi |
Posted - 2010.11.19 20:21:00 - [ 3]
Im afraid googling hasn't really helped me =/ atm im writing a recursive loop, is that the right idea? |
 Hel O'Ween Men On A Mission EVE Trade Consortium |
Posted - 2010.11.19 22:27:00 - [ 4]
Perhaps be a bit more specific with which API call you're dealing.
I'm only doing market/trade related APIs (wallet journal, market orders and the like) and of those, the only API call which seems to cry "tackle me recursively" is the assets API, as you got items nested in items (modules in containers, containers in ships and the like). Any other API in that realm else is just a flat list of rows, where recursion doesn't provide any benefit. |
 Nikolai Kondratiev Sphere Design Inc. |
Posted - 2010.11.20 03:36:00 - [ 5]
For assets stuff, just check for each node if it has subnodes and parse those (and sub-sub-nodes too if there is any) before moving to next ones. |
 Dragonaire Caldari Corax. PURgE Alliance |
Posted - 2010.11.20 04:19:00 - [ 6]
It's not in Java of course but if you want to understand how to work with AssetList take a look at Yapeal I think you'll find PHP isn't that much different that you can't understand it. like in class/api/charAssetList.php. Also in the Yapeal wiki you'll find a couple of pages talking about methods that can be used with recursive structures. |
 Lutz Major |
Posted - 2010.11.20 10:31:00 - [ 7]
The assets list is the most easiest one. I use JAXB. It's about 15 lines of (un)marshalling code and of course the Asset object itself. Send me a short mail and I can forward you the code, if you like |