Ok, i'm tired and my head hurts, and this problem is making me itch horribly.

I have a bit of xml in this format:

<node>
   <text plainText="First topic"/>
   <node>
      <text plainText="Subtopic"/>
   <node>
   <node>
      <text plainText="Subtopic"/>
      <node>
          <text plainText="SubSubtopic"/>
      </node>
      <node>
          <text plainText="SubSubtopic"/>
      </node>
      <node>
          <text plainText="SubSubtopic"/>
      </node>
      <node>
          <text plainText="SubSubtopic"/>
      </node>
   <node>
   <node>
      <text plainText="Subtopic"/>
   <node>
   <node>
      <text plainText="Subtopic"/>
   <node>
</node>

In short, there's one topic at the bottom of the tree, which branches out into 4 sub-topics. Then one of those subtopics has 4 subtopics under that again, and any one of those subtopics could branch further. The problem here is that the vertical scale of the visual representation of one of these topics grows with every addition to any tree under them. So for instance the second subtopic, which has 4 more topics nested, would push the first, third and fourth subtopic up and down by about half the height of its own tree.

For an illustration, check out http://andreas.rayon.no/temp/tree.jpg

Now how the hell do i get the scale of a tree like that. The first topic could be 20 px high, but has 2 topics nested, making it 40 px tall (since they spread vertically and horizontally). Then one of those topics again could have 3 topics nested, and one of those could have one nested, and then that could have 8 nested again. How do i go through the tree to get the height and align like that? I've never had to work with xml with this depth before and it's really tearing at my head.
Anyone done anything like this before?

- Andreas
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to