"your query returned an empty sequence"
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 3
- Joined: Thu Mar 23, 2017 6:18 pm
"your query returned an empty sequence"
I'm an XQuery beginner.
When I run a query like
I get this error message: "your query returned an empty sequence"
When I run it as
i.e., without "//head", it returns the whole xml document.
Help?
When I run a query like
Code: Select all
declare default element namespace "https://github.com/dig-eg-gaz/content";
for $a in doc("1905-01-06.xml")
return $a//head
When I run it as
Code: Select all
declare default element namespace "https://github.com/dig-eg-gaz/content";
for $a in doc("1905-01-06.xml")
return $a
Help?
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: "your query returned an empty sequence"
Hi,
What about if you use: If this works, check the namespace of "head" in the XML file.
BTW, not sure what you're trying to accomplish, but that 'for' seems pointless on the doc() with one file.
Maybe you wanted to iterate on the head elements?
Like this:
Actually if you're not doing anything in the for, you might as well not use it:
Regards,
Adrian
What about if you use:
Code: Select all
return $a//*:head
BTW, not sure what you're trying to accomplish, but that 'for' seems pointless on the doc() with one file.
Maybe you wanted to iterate on the head elements?
Like this:
Code: Select all
declare default element namespace "https://github.com/dig-eg-gaz/content";
for $a in doc("1905-01-06.xml")//head
return $a
Code: Select all
doc("1905-01-06.xml")//head
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 3
- Joined: Thu Mar 23, 2017 6:18 pm
Re: "your query returned an empty sequence"
Thanks, Adrian. This is helpful. I guess I don't understand how namespaces work in XQuery, but *:head seems to work fine provisionally, as you suggested.
What I'm trying to do is return various results from about 300 TEI/XML files in a github repository ("https://github.com/dig-eg-gaz/content"). I've been querying these files as a project in Oxygen using XPath; that works fine, but I'm trying to figure out how to do some more complex queries.
I've spent quite a while looking at XQuery tutorials, but I seem not to be able to return results from my whole repository. All I can manage is to return results from one doc at a time, either by specifying it as doc("1905-05-06.xml") or opening the doc in Oxygen.
Sorry to ask such basic questions but I'd be grateful for any assistance.
Yours,
Will
What I'm trying to do is return various results from about 300 TEI/XML files in a github repository ("https://github.com/dig-eg-gaz/content"). I've been querying these files as a project in Oxygen using XPath; that works fine, but I'm trying to figure out how to do some more complex queries.
I've spent quite a while looking at XQuery tutorials, but I seem not to be able to return results from my whole repository. All I can manage is to return results from one doc at a time, either by specifying it as doc("1905-05-06.xml") or opening the doc in Oxygen.
Sorry to ask such basic questions but I'd be grateful for any assistance.
Yours,
Will
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: "your query returned an empty sequence"
Hi,
You need to use collection() to work on multiple XML files, but I'm not sure how you could do that directly on the github repository. The problem is obtaining the list of files from the github repository (full URLs). If you have that, you could iterate over them.
If the repository is in a folder from the local file system and you're using Saxon 9, you can use collection() like this:
Regards,
Adrian
You need to use collection() to work on multiple XML files, but I'm not sure how you could do that directly on the github repository. The problem is obtaining the list of files from the github repository (full URLs). If you have that, you could iterate over them.
If the repository is in a folder from the local file system and you're using Saxon 9, you can use collection() like this:
Code: Select all
for $a in collection("file:/C:/path/to/my/files/?select=*.xml;recurse=yes")
return $a
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service