Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I think Im almost there with the tree..please let mw know what you think

 
Matt Kohanek
Village Idiot
Ranch Hand
Posts: 484
Java jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
- - I feel like I am getting close with this finally - -

So as someone at the company Im doing this for so succinctly put it:

"Why not just build up the tree from the objects returned by simpleXML?

1) Call Web service
2) Use simple to parse XML into objects
3) loop through objects and add to TreeNode data"


Here I have a class to set a tree node with setters and getters:




edit - continued in reply
 
Matt Kohanek
Village Idiot
Ranch Hand
Posts: 484
Java jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or here we go -

I have



to get the data from the service, and then this to parse it:



So now I need to use this to set the value of data:



my problem I guess is what should go in node1.setData();

I think it will be one of three things:

node.setData(node.getChild(deviceId));

or

node.setData(data.getChild(deviceId));

or

node.setData(deviceCollection.getChild(deviceId));

Im playng around with it now, so hopefully I will have the answer on my own soon, but please let me know if you see me going wrong somewhere
 
Matt Kohanek
Village Idiot
Ranch Hand
Posts: 484
Java jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm

Ok I have a DeviceCollection class that looks like this:



And if I use simplexml to parse the follwoing into this list object:



What is this list going to look like? I need to study up more on java collections I think..
Im doing so now but if anyone can help clear it up it will save me some time
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic