• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Trying to bind data to a TreeNode attribute using data read from a web service with simple xml

 
Village Idiot
Posts: 484
jQuery Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is basically what I need to do:

1) Call Web service and get the xml
2) Use simpleXML to parse XML into objects
3) loop through objects and add to TreeNode data; attribute.

I have a bunch of loose code that does much of this, but it is missing something and Im having trouble filling in the gaps.

So I have this class which is how I call the web service and get the data:



I also have a Device class:



and a device Collection class:



Then I have my Temp class, which I am trying to use to bind the data from the DeviceColelction to TreeNode data;



I think I have my temp class fixed now. But now my last problem is using deviceCollection to build my tree. I thought deviceCollection would be considered a list so I could do deviceCollection.get() but appaently thats not the case
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Only looked at this _very_ quickly, so hopefully others comment, but I I don't think your DeviceCollection class can be considered a List, it's a wrapper around a List. So you need to get the list out of your wrapper class first before performing a get() on it.
 
Matt Kohanek
Village Idiot
Posts: 484
jQuery Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
eh, Im not even sure I need it to act like a list...

All I really know is that I have a page that has an xml schema that is very simple, one root and two child nodes that changes depending on the user (can be multiple root nodes with the two child nodes)

I am needing to bind the values of the root and two child nodes to something, which I can then call in my richfaces tree to populate the branches.

Ive posted so many topics and looked at so many tutorials I am just overloaded with un needed knowledge that doesnt pertain to my problem, btu just gets in the way of my figuring out how to solve it

If I werent on a deadline I would just give up on this at this point, but Im between a rock and a hard place
 
Matt Kohanek
Village Idiot
Posts: 484
jQuery Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I mean there has to be some way to say (programmatically):

1 - look at this xml schema
2 - take whatever the text node value is for <deviceId> and set it equal to String device;

It seems so simple, but I just cant seem to do it!!
 
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Matt Kohanek wrote:eh, Im not even sure I need it to act like a list...

All I really know is that I have a page that has an xml schema that is very simple, one root and two child nodes that changes depending on the user (can be multiple root nodes with the two child nodes)

I am needing to bind the values of the root and two child nodes to something, which I can then call in my richfaces tree to populate the branches.

Ive posted so many topics and looked at so many tutorials I am just overloaded with un needed knowledge that doesnt pertain to my problem, btu just gets in the way of my figuring out how to solve it

If I werent on a deadline I would just give up on this at this point, but Im between a rock and a hard place



You are almost there, but your DeviceCollection should return a list and not a collection because I think it JSF RI will not downcast from a Collection to any subclass.
Alternately, you already parse out your XML so just create a class which holds data for each user, based on your description above I am just laying out a basic
structure


in your jsf then for the tree nodes , you can iterate through list of xmlnodes and each node can get the value
xmlNodes[0].rootNode[0].deviceId or something similar

Not sure if it helps but that's what came in up my head while sipping coffee !


P.S any bartender: for some odd reason the forum did not show my reply, I am resubmitting this reply again
 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kavita Tipnis wrote:
P.S any bartender: for some odd reason the forum did not show my reply, I am resubmitting this reply again



We've been experiencing some difficulties yes, rest assured a number of staff are looking into a fix.
 
Don't touch me. And dont' touch this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic