Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

base-uri throws Error XQST0046 when I trying to apply base-uri to nodes #1464

Closed
donaldjohn opened this issue Jun 22, 2017 · 2 comments
Closed

Comments

@donaldjohn
Copy link
Contributor

donaldjohn commented Jun 22, 2017

My XQuery like this:
for $cit in /*:CitedReferenceCIT[@status = 'D'] where contains($cit/@file, "#") return string-join(base-uri($cit/@file))
When I run this query, I got the error prompt like this:
Error: Stopped at C:/Users/Administrator/Desktop/XQuery/233Update.xq, 3/28: [XQST0046] URI '/STD_KR_CIT_ZIP/20160927/20070102/20070102-1-001.ZIP/1/KR202007000003512KR00200700003560ACITKO20070102KR00#/KR202007000003512KR00200700003560ACITKO20070102KR00#.XML' is invalid.
It seems related to the '#', but this is what it is in the file path, there is no way to overcome this, Can anyone tell me how to overcome this?

@ChristianGruen
Copy link
Member

Various characters (#, ^) are no legal URI characters. They would need to be encoded before they are stored in a database. As this introduces backword compatibility issues (…after the change, a file #.xml will need to be adressed by db:open('db', '%23.xml'), it has not been fixed so far.

A hack to overcome this could be to create your uri manually (e.g. via 'iri-to-uri(file:///' || $your-root-directory || $cit/@file)). Maybe you don’t even need to encode the path to a base URI, but this depends on what you what you do with it. And I assume that your usage of string-join is obsolete?

As this is a duplicate of #1172, I’ll be closing this issue. For general questions and unconfirmed bugs, please write to our basex-talk mailing list.

@donaldjohn
Copy link
Contributor Author

I want to get the document path of the node, I checked #1172 and found that db:path is more suitable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants