[jdom-interest] getting xpath of modified jtree-view
Daniel Purucker
dpu at daniel-purucker.de
Wed Mar 24 10:56:02 PST 2004
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
More information about the jdom-interest
mailing list