You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Florian Schaper <fs...@intux.org> on 2003/02/20 04:12:53 UTC
Parse tree structures/collections with xPath and xindice
Hello,
I guess this problem already has been addressed a few dozen times already
but I couldn't find a specific enough answer in the archives and after all
openSource is fast to develop so I will state my question anyway ...
I want to store a tree like structure in Xindice say
menu
....menu
.....menu
........menu
my solution would now have been to split this single file (which becomes
quite large) into single "property" documents in menu collections like
/db/mymenus/menuID1/menuID7/... or something like that ..
however I still would need to query all that in xPath as an single document
like //menu[@id='blah']
A few tests and a brief look in the archives are somewhat discuraging but
maybe I missed something (I hope so cause like the project desciption states
"free directory/tree structures are the strength of XML" ... )
If not maybe somebody has already a good concept to "simulate" this and
still keep adequate performances for lookups?
<menu>
<props>
...
</props>
<menu>
<props>
...
</props>
<menu>
<props>
...
</props>
</menu>
<menu>
<props>
...
</props>
</menu>
</menu>
</menu>
./regards
Florian
RE: Parse tree structures/collections with xPath and xindice
Posted by Lixin Meng <li...@brownpot.com>.
Just one quick idea.
Assume that your original big menu file looks like below, (it is same as the
one in your email, but with the '@id' that implies the hierarchy):
<menu id='m1'>
<props>
...
</props>
<menu id='m11'>
<props>
...
</props>
<menu id='m111'>
<props>
...
</props>
</menu>
<menu id='m112'>
<props>
...
</props>
</menu>
</menu>
</menu>
Save them into a single collection '/db/mymenus' as separate files:
-- file1.xml -----
<menu id='m1'>
<props>
...
</props>
</menu>
-- file11.xml -----
<menu id='m11'>
<props>
...
</props>
</menu>
-- file111.xml -----
<menu id='m111'>
<props>
...
</props>
</menu>
-- file112.xml -----
<menu id='m112'>
<props>
...
</props>
</menu>
...
When perform lookup, try things like:
/menu[starts-with(@id, 'm1')]
It will grab all related sub-menu at once, if that's what you concerned
about the performance.
Just some thoughts. No test performed.
Regards,
Lixin
-------------------------
XDataFinder, another way to browse XML database
http://www.brownpot.com/sw_profile.html
-----Original Message-----
From: Florian Schaper [mailto:fschaper@intux.org]
Sent: Wednesday, February 19, 2003 7:13 PM
To: xindice-users@xml.apache.org
Subject: Parse tree structures/collections with xPath and xindice
Hello,
I guess this problem already has been addressed a few dozen times already
but I couldn't find a specific enough answer in the archives and after all
openSource is fast to develop so I will state my question anyway ...
I want to store a tree like structure in Xindice say
menu
....menu
.....menu
........menu
my solution would now have been to split this single file (which becomes
quite large) into single "property" documents in menu collections like
/db/mymenus/menuID1/menuID7/... or something like that ..
however I still would need to query all that in xPath as an single document
like //menu[@id='blah']
A few tests and a brief look in the archives are somewhat discuraging but
maybe I missed something (I hope so cause like the project desciption states
"free directory/tree structures are the strength of XML" ... )
If not maybe somebody has already a good concept to "simulate" this and
still keep adequate performances for lookups?
<menu>
<props>
...
</props>
<menu>
<props>
...
</props>
<menu>
<props>
...
</props>
</menu>
<menu>
<props>
...
</props>
</menu>
</menu>
</menu>
./regards
Florian