Hi,
I work on a project involving some large xml files that we need to search
for specific attribute values, and I tried a solution based on BaseX
database. After several hours of searching I found no way to serialize the
answer as I needed (the elements that had the searched attribute value and
all their parents). As I only had two days for a proof-of-concept I made my
own serializer and now the result is as I expect it to be. As I find these
feature to be useful I attached the source code and maybe you'll consider
to include such a feature in a future release. Unfortunately I had to hack
Serializer.java, as the node() method was final, and I suggest you at least
to make the Serializer more configurable (eg. a properties file for the
serialization options and the class to use and then
reflection, splitting the node() method into several override-able
sub-methods).
On the other hand, maybe there is a way to obtain the result I needed using
the existing features of basex, but as I told you I hadn't much time and
this seemed to me the quickest solution.
Best Regards,
Tiberiu Tofan