[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

How to run xquery dynamically on file listing from directory

Wei, Alice J. ajwei at indiana.edu
Sat Apr 12 17:35:56 PDT 2008


  How to run xquery dynamically on file listing
	from	directory
_______________________________________
From: Kevin Grover [http://x-query.com/mailman/listinfo/talk]
Sent: Thursday, April 10, 2008 9:00 PM
To: http://x-query.com/mailman/listinfo/talk
Cc: http://x-query.com/mailman/listinfo/talk
Subject: Re:  How to run xquery dynamically on file listing from   directory

On Thu, Apr 10, 2008 at 11:22 AM,  <http://x-query.com/mailman/listinfo/talk> wrote:
> I'm a complete newbie at xquery and am trying to execute a query dynamically on
>  all files in a given directory, rather than hardcoding a particular file into
>  the 'doc()' call.  I've tried using 'collection()' but am unclear as to how to
>  get it to work.
>
>  I did see this thread on x-query.com:
>   Query Through Multiple Files
>  but the closest anyone came to the answer I was hoping to find was to hardcode a
>  *list* of files to traverse.
>
>  Is there anyway to do something like:
>     for $x in collection("xmlfiles")
>  where 'xmlfiles' is a subdirectory containing the actual xml files I want to
>  use?  I would need to know the exact syntax, as this is all new to me.
>
>  Thanks!

I feel for you on this.  It's taken me weeks to figure anything out.
The crux if it is that the 'collection()' function is implementation
dependent.

I've been trying with saxon for a long while and could not find any
documentation or examples.  After many attempts at searching (Google),
 and some dumb luck (I searched the main saxon documentation toc  for
collection), I found saxon's documentation page:

http://www.saxonica.com/documentation/sourcedocs/collections.html

Still, no examples, but better.  From that page, I think I can
probably get my stuff going.  What I wanted to do at the time was more
of a small itch than and real need, so I tended to look into it
somewhat shallowly and sporadialy.

NOTE: I was stuck with a non Internet connected machine, so I had to
search later, from other machines.  I tried downloading the saxon
documentation, but all seemed incomplete.  I grabbed saxon9, and just
recently grabbed it's doc distro, but have not tried to search it for
this.  Maybe I will.  I would (personally) like to see the Saxon
Documentation rendered into many forms (PDF, HTML, CHM) from something
like DocBook.  It would also be _very_ helpful if there were more
examples.  I've been meaning to ask if I could help do this (at least
to convert the HTML documentation tree to DocBook), but never got
around to it.

If you're using an all-in-one editor, you'll have to dig into it to
see what back end they use.  I believe oXygen XML uses Saxon (but I'm
not certain).

Yes, oXygen does support Saxon. Using something like collection("somefiledirectory") that contains all XML files should be able to get something you wanted. Unless, you want other things along with it, which then you might have to show what you got so far.

This is one of those things that seems sort of simple when I find the
answer, but was completely baffling beforehand - particularly since I
could not seem to find anything online.

I have to agree that right now there are some thing that ought to be simple enough, but since XQuery is so new, there are not that many examples for every use case

Hope this helps.

Alice
======================================================
Alice Wei
MIS 2008
School of Library and Information Science
Indiana University Bloomington
http://x-query.com/mailman/listinfo/talk



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.