xquery on multiple documents

I am trying to perform an xquery on a folder of xml documents.

How do I do this.

Can I pass a file as a parameter to xquery ( I am using zorba)
or do the following ( which doesnt work):

for $href  in /folder1/folder2/
      for $x in doc ( $href )/task
             return $x/unity
geldfeldAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Geert BormansInformation ArchitectCommented:
The answer likely is in using the collection() function

Saxon and a bunch of other processors I worked with allow this form
for $book in collection("file:///c:/books?select=*.xml ")

Never tried it in Zorba though
Can you try that first?
0
geldfeldAuthor Commented:

Zorba does allow the collection function but I seem to be getting the URL path wrong.

I want to go through the test directory in my current folder. So I did the following:

for $xml in collection("file://test?select=*.xml ")
           for $x in $xml/task
           return  $x/unity 

Open in new window


it throws an "invalid argument"

0
geldfeldAuthor Commented:


This query on a single document returns all the children and the childrens children of $x/unity

I just want to show the element names of the immediate children. how do I get it to stop returnign everything?
0
Geert BormansInformation ArchitectCommented:
you need to have three '/' instead of two in the file:/// protocol

the second follow up I don't understand, the XQuery you show should not do that
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
James MurrellProduct SpecialistCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
XML

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.