Sign In/My Account | View Cart  
advertisement

Article:
 Getting Started with XQuery
Subject: Iterating Through Files
Date: 2005-03-26 15:43:27
From: phidias

I noticed in your example that you first created an XML document that contained URLs for all of the files that you wanted to iterate through. I was wondering if there's a way to iterate through a series of files? Something like this:


for $doc in
collection('recipeml/*.xml')


Previous Message Previous Message   Next Message Next Message


Titles Only Titles Only Newest First
  • Iterating Through Files
    2005-03-27 08:25:57 Bob DuCharme [Reply]

    You could try it, but if it works with one XQuery implementation it won't necessarily work with another. From http://www.w3.org/TR/xpath-functions/#func-collection:


    "This function provides a facility for users to work with a collection of documents which may be contained in a directory or rows of a Relational table or other implementation-specific construct. An implementation may also use external variables to identify external resources, but fn:collection() provides functionality not provided by external variables."


    So the implementation has some leeway.


    Because I love the name func-collection so much, I will also add the URL http://www.amazon.com/exec/obidos/tg/detail/-/B000007RQ9/103-8915257-7975822


    • Iterating Through Files
      2005-11-09 21:23:18 scam [Reply]

      But even if that does work, is there any guarantee that the query would be starting afresh for each new file? Becoz i need to do that. I need the query to execute through each xml file in a directory (even under subdirectories of this directory). but it should consider each file as a new beginning. any help on this would be most welcome. please? Thanks a million anyways. :)


Sponsored By: