Can I use XQuery to query all XML files under a specific directory? All the XML files have the same structure.
Also, from what I have seen you can XQuery many files but you need to write the names of them in the query. In my case, I need to query 500 XML files with quite different names each. So Is there a way I can say:
for $x in doc("ALL files under a specific directory")/Foo
return $x/Something
Querying in an XQuery contextIf your query invokes an XQuery expression directly, you must prefix it with the case-insensitive keyword XQUERY. To retrieve all of the XML documents previously inserted into the INFO column, you can use XQuery with either db2-fn:xmlcolumn or db2-fn:sqlquery.
It is used to retrieve information stored in XML format. XQuery for XML is similar as SQL for databases. It can be used on XML Databases, relational databases containing data in XML formats or XML documents.
XQuery is About Querying XML XQuery is a language for finding and extracting elements and attributes from XML documents.
NOTE: XQUERY files more commonly use the . XQ extension.
For MarkLogic:
for $x in cts:search(fn:doc()/Foo, cts:directory-query("/target/directory/"))
return $x/Something
Use the collection()
function.
In its Saxon implementation, one can use:
collection('file:///a/b/c/d?select=*.xml')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With