Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

[jdom-interest] getting xpath of modified jtree-view

Daniel Purucker

2004-03-24

Replies:

Hello everybody,

i've got some design-problems using jdom, the jtreeoutputter and xpath:
I'm using a modified jtreeoutputter to show an xml-file in a
jtree-component. I had to modify the outputter, because the xml-file
looks like this:

part of the xml-file:

  <void property="nachsteuer">
   <void property="ausserordentlicheAufwendungenUndErtraege">
    <void property="ausserordentlicheErtraege">
    <void index="0">
     <long>2200000</long>
    </void>
   </void>
  </void>
</void>

..a lot more of this stuff...

 <object
class="de.zew.veranlagungssimulation.Modell.Unternehmensmodell.Wirtschaf
tsgut">
 <string>Wirtschaftsgut</string>
      <void property="anschaffungsperiode">
       <int>1</int>
      </void>
      <void property="anschaffungswert">
       <long>2150000</long>
      </void>
</object>

..and so on: So i can't just show the tags in the jtree-view, because
the user would just see a lot of void and obejct. - So i had written
code, to show either the property-value, or the string, or the data,
which is relevant, and just ignoring the void and obejct-stuff. The
jtree now looks like this:

tree:
nachsteuer
|__ ausserordentlicheAufwendungenUndErtraege
     |___ ausserordentlicheErtraege
            |___ Periode 0:
                  |____ 2200000

and:
Wirtschaftsgut
|_ anschaffungsperiode
   |___ 1
|_anschaffungswert
   |___ 2150000

Now my proble is: i'd like to show the children of a specific node (the
one the user clicked) inside of a table. And - i think - for this task
i need the xpath-expression of the selected node - or to be more
precise - of the underlying jdom-model. Now the quetion is: How do i
get that xpath?

The only solution i could think about is to store the corrisponding
xpath of every jtree-node inside of an array (i'd have to do this while
transforming the tree in my jtreeoutputter. Is this the only solution,
is there a better (perhaps faster - i think my solution would take a
lot of power) one? We would be pleased to receive some hints,
information and tips.

Thanx in advance,
Daniel

_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.