Dear Christian,Thank's for your quick reply. I try to give you an example as I don't think my english is good enough to explain you otherwise:For a xml like:<AAA><BBB att1="bbb"><CCC att1="ccc"/><DDD att1="ddd"><EEE att1="eee"/></DDD></BBB></AAA>If i search for "ddd" i need the result to be:<AAA><BBB att1="bbb"><DDD att1="ddd"/></BBB></AAA>Maybe this result can be achieved using xquery, I'm not sure as I don't know xquery well enough. I only tried using xpath, and with xquery I only scratched the surface, and as it wasn't leading me in the right direction and I was running out of time I had to use the solution that I've send you. From what I could figure out in Serializer.java, it seems to me that all the children of a result are serialized as well. I think it's worth mentioning that I don't know the structure of the xml in which i'm serching, and with XMLExtractSerializer I only use the xpath //*[@* contains text '%s'] and it gives me the result I need.If you think this can be achieved using XQuery please let me know and I'll allocate more time to look into it.Thank you for your time!Best regards,TiberiuOn Mon, Dec 12, 2011 at 4:22 PM, Christian Grün <christian.gruen@gmail.com> wrote:Dear Tiberiu Tofan,
thanks for your code snippet, always welcome! Before including new
code, I'd like to ensure that it will represent added value for other
users as well, so.. may I ask what your XMLExtractSerializer class is
supposed to do? Maybe it can also be realized via XQuery?
Christian
___________________________
> _______________________________________________
On Mon, Dec 12, 2011 at 3:15 PM, Tiberiu Tofan <tibtof@gmail.com> wrote:
> 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
>
> BaseX-Talk mailing list
> BaseX-Talk@mailman.uni-konstanz.de
> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk