Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
No replies
SystemAdmin
SystemAdmin
746 Posts
ACCEPTED ANSWER

Pinned topic Using XQuery to search for specific nodes

‏2013-03-23T19:31:53Z |
I'm a newbie in XQuery and I'm having to search though big collection of files, the XML doc have a structure like this,

<files>
<file>
<name>1</name>
<contents>
<content>games</content>
<content>movies</content>
</contents>
</file>
<file>
<name>2</name>
<contents>
<content>games</content>
<content>picture</content>
<content>work</content>
</contents>
</file>

Its like files are tagged with some tag based on their content. I will have a set containing the tag words like ("games","picture") should return file2

so far i wrote only this

declare function local:getFile ($files,$keywords) {
for $file in $files
return (if (local:checkFile($file/keywords,$keywords)) then $file else "")
};
declare function local:checkFile ($fileKeywords,$keywords) {
true()
};

I want to know whether this is possible with XQuery? if possible, just give me some guidelines, i'm not aware of all xquery constructs, thats my main drawback