File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes I think Im almost there with the tree..please let mw know what you think Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "I think Im almost there with the tree..please let mw know what you think" Watch "I think Im almost there with the tree..please let mw know what you think" New topic
Author

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

Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 483

- - 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


True wisdom is in knowing you know nothing - Socrates
Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 483

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

Joined: Apr 04, 2009
Posts: 483

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I think Im almost there with the tree..please let mw know what you think
 
Similar Threads
TreeNode ClassCastException?
Does TreeNode hold multiple values?
Question about Tree Node
How to find Path with Max weight
Trees in Java