10 Replies Latest reply on Jun 8, 2009 4:14 PM by Matt Kohanek

    need a bit more help getting tree to work as intended

    Matt Kohanek Novice

      I think I am just mis-using some of the elements or attributes. I have looked at tutorials and such but cant seem to figure this one out.
      If I understand correctly what I have read, I can first load a list with some xml. I have gotten to this point. I have a list I call ids. When I do this line:

      System.out.println("Printing out ids list: "+ids.toString());

      it prints out:

      Printing out ids list: [<?xml version="1.0" encoding="UTF-8"?>
      <deviceCollection>
       <device>
       <deviceId>spaces2</deviceId>
       <name>spaces2</name>
       </device>
       <device>
       <deviceId>exampleDevice1</deviceId>
       <name>Example Device 1</name>
       </device>
       <device>
       <deviceId>JSFTEST02</deviceId>
       <name>JSFTEST02</name>
       </device>
      </deviceCollection]


      I cut out some of the values but as you can see, my list "ids" now holds this xml.

      So lets say I want to use deviceId as the roots, and name for the child under each root.

      So using the value of ids I have there, it should come out like this:

      |-spaces2
      |---spaces2
      |
      |-exampleDevice1
      |---Example Device 1
      |
      |-JSFTEST02
      |---JSFTEST02

      Just a simple tree right? So how can I do this?

      Right now I am doing something else. Right now I am loading my ids list with just the deviceId values, so my list when printed as a string looks like:

      printing: [spaces2, exampleDevice1, JSFTEST02]

      Now this is very simple to bind to a tree, but I end up with a tree that has three branches and no child nodes.
      Playing around with that I get various results, but nothing I am looking for.


      So basically, I have a list that is loaded with xml data, and I need to use the deviceId element as the root and the name element as the nodes under the roots.
      I know I have read that this is possible, but I cant figure out how to do this.
      I have seen an example that used var="items" nodes="#{items.nodes}"
      but I cant make any sense of this. I have looked through many tutorials and such and cant seem to get this.

      Please help?