[Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
The proposal to merge lp:~zorba-coders/zorba/feature-uri_module into lp:zorba has been updated. Status: Approved => Merged For more details, see: https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
Validation queue job feature-uri_module-2012-03-06T02-57-33.518Z is finished. The final status was: All tests succeeded! -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
Validation queue starting for merge proposal. Log at: http://zorbatest.lambda.nu:8080/remotequeue/feature-uri_module-2012-03-06T02-57-33.518Z/log.html -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
The proposal to merge lp:~zorba-coders/zorba/feature-uri_module into lp:zorba has been updated. Status: Needs review => Approved For more details, see: https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
The downside of building this functionality into Zorba: In release mode, the .xq file isn't read, so the implemented-in-XQuery functions don't exist. I don't remember the right solution, though. -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
The proposal to merge lp:~zorba-coders/zorba/feature-uri_module into lp:zorba has been updated. Status: Approved => Needs review For more details, see: https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
The attempt to merge lp:~zorba-coders/zorba/feature-uri_module into lp:zorba failed. Below is the output from the failed tests. CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message): Validation queue job feature-uri_module-2012-03-06T00-39-09.268Z is finished. The final status was: 2 tests did not succeed - changes not commited. Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
Validation queue starting for merge proposal. Log at: http://zorbatest.lambda.nu:8080/remotequeue/feature-uri_module-2012-03-06T00-39-09.268Z/log.html -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
The proposal to merge lp:~zorba-coders/zorba/feature-uri_module into lp:zorba has been updated. Status: Needs review => Approved For more details, see: https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
The proposal to merge lp:~zorba-coders/zorba/feature-uri_module into lp:zorba has been updated. Status: Approved => Needs review For more details, see: https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
The attempt to merge lp:~zorba-coders/zorba/feature-uri_module into lp:zorba failed. Below is the output from the failed tests. CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message): Validation queue job feature-uri_module-2012-03-05T23-11-19.724Z is finished. The final status was: 2 tests did not succeed - changes not commited. Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
Validation queue starting for merge proposal. Log at: http://zorbatest.lambda.nu:8080/remotequeue/feature-uri_module-2012-03-05T23-11-19.724Z/log.html -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
The proposal to merge lp:~zorba-coders/zorba/feature-uri_module into lp:zorba has been updated. Status: Needs review => Approved For more details, see: https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
Review: Approve -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
The proposal to merge lp:~zorba-coders/zorba/feature-uri_module into lp:zorba has been updated. Status: Approved => Needs review For more details, see: https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions. -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
Review: Approve Typo: "characeters" in the doc of all three uri.xq functions. Other than that, changes look good. I'll approve now so you can merge after correcting the typo. -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
- fixed the parameter for the transcoding stream - changed the code such that plus-decoding is done before percent-decoding as stated in the docs - added a note about the assumptions on the input to be ascii-only -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
The proposal to merge lp:~zorba-coders/zorba/feature-uri_module into lp:zorba has been updated. Commit Message changed to: A new module that provides URL-related functions. Currently, it provides functions to do URL-decoding but other URL-related functions (e.g. to retrieve the scheme or path) will be added later. For more details, see: https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
The proposal to merge lp:~zorba-coders/zorba/feature-uri_module into lp:zorba has been updated. Status: Needs review => Approved For more details, see: https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
Matthias Brantner has proposed merging lp:~zorba-coders/zorba/feature-uri_module into lp:zorba. Requested reviews: Chris Hillery (ceejatec) Matthias Brantner (matthias-brantner) For more details, see: https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 A new module that provides URL-related functions. Currently, it provides functions to do URL-decoding but other URL-related functions (e.g. to retrieve the scheme or path) will be added later. -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/96005 Your team Zorba Coders is subscribed to branch lp:zorba. === modified file 'ChangeLog' --- ChangeLog 2012-03-01 21:22:16 + +++ ChangeLog 2012-03-05 21:32:53 + @@ -13,6 +13,7 @@ * Fixed bug 917923 (bug in copying outer var values into the eval dynamic context) * Fixed bug 867509 (Can not handle largest xs:unsignedLong values) * Fixed bug 924063 (sentence is incorrectly incremented when token characters end without sentence terminator) + * New URI module providing percent-decoding functions. * Optimization: change the implementation of the free-vars annotation and got rid of the annotations map in expressions. * Fixed bug 909126 (bug in cloning of var_expr) === modified file 'modules/com/zorba-xquery/www/modules/CMakeLists.txt' --- modules/com/zorba-xquery/www/modules/CMakeLists.txt 2012-02-16 14:11:02 + +++ modules/com/zorba-xquery/www/modules/CMakeLists.txt 2012-03-05 21:32:53 + @@ -63,6 +63,8 @@ URI "http://www.zorba-xquery.com/modules/schema";) DECLARE_ZORBA_MODULE(FILE string.xq VERSION 2.1 URI "http://www.zorba-xquery.com/modules/string";) +DECLARE_ZORBA_MODULE(FILE uri.xq VERSION 1.0 + URI "http://www.zorba-xquery.com/modules/uri";) DECLARE_ZORBA_MODULE(FILE xml.xq VERSION 2.0 URI "http://www.zorba-xquery.com/modules/xml";) DECLARE_ZORBA_MODULE(FILE xqdoc.xq VERSION 2.0 === added file 'modules/com/zorba-xquery/www/modules/uri.xq' --- modules/com/zorba-xquery/www/modules/uri.xq 1970-01-01 00:00:00 + +++ modules/com/zorba-xquery/www/modules/uri.xq 2012-03-05 21:32:53 + @@ -0,0 +1,108 @@ +xquery version "1.0"; + +(: + : Copyright 2006-2012 The FLWOR Foundation. + : + : Licensed under the Apache License, Version 2.0 (the "License"); + : you may not use this file except in compliance with the License. + : You may obtain a copy of the License at + : + : http://www.apache.org/licenses/LICENSE-2.0 + : + : Unless required by applicable law or agreed to in writing, software + : distributed under the License is distributed on an "AS IS" BASIS, + : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + : See the License for the specific language governing permissions and + : limitations under the License. +:) + +(:~ + : This module provides string related functions. + : + : @author Matthias Brantner + : @project XDM/atomic + : + :) +module namespace uri = "http://www.zorba-xquery.com/modules/uri";; + +declare namespace zerr = "http://www.zorba-xquery.com/errors";; + +declare namespace ver = "http://www.zorba-xquery.com/options/versioning";; +declare option ver:module-version "1.0"; + +(:~ + : Percent-decodes (aka URL decoding) the given string. + : + : All percent encoded octets will be translated into their + : decoded UTF-8 representation. + : + : Please note that the percent encoding guarantees that a string + : consists of ASCII characters only. Passing a string that contains + : non-ASCII characeters results in undefined behavior. + : + : @param $s the string to decode + : + : @return the percent decoded string + :) +declare function uri:decode($u as xs:string) as xs:string +{ + uri:decode($u, fn:false()) +}; + +(:~ + : Percent-decodes (aka URL decoding) the given string. + : + : All percent encoded octets will be translated into their + : decoded UTF-8 representation. + : + : If $decode-plus is specified all occurrences of the char '+' + : will be replaced with a space ' ' before the percent decoding + : happens. + : + : Please note that the percent encoding guarantees that a string + : consists of ASCII characters only. Passing a string that contains + : non-ASCII characeters results in undefined behavior. + : + : @param $s the string to decode + : @param $decode-plus whether '+' chars will be replaced with spaces + : + : @return the percent decoded string + :) +declare function uri:decode( + $u as xs:string, + $decode-plus as xs:boolean) as xs:string +{ + uri:decode($u, $decode-plus, "UTF-8") +}; + +(:~ + : Percent-decodes (aka URL decoding) the given string. + : + : All percent encoded octets will be translated into their + : decoded UTF-8 representation. + : + : If $decode-plus is specified all occurrences of the char '+' + : will be replaced with a space ' ' before the percent decoding + : happens. + : + : The $charset parameter specifies the source charset after precent + : decoding. It is used to convert the decoded string into UTF-8. + : + : Please note that the
Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
Two corrections: - The transcode::stream is given an explicit source encoding of ISO-8859-1. Surely it should be passed lCharset? - The XQDoc for uri:decode() says that '+' will be replaced with ' ' before percent-decoding. It is in fact done afterwards. I think actually it should be done first, as the doc says, otherwise %2B will get converted to a space which is probably not desirable. One question: Is it guaranteed to be safe to do percent-decoding and plus-substitution regardless of the encoding of the input string? Are we presuming that since it's been percent-encoded, the input string is strictly ASCII? It may be best to note that assumption in the doc as well. -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/94492 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
The proposal to merge lp:~zorba-coders/zorba/feature-uri_module into lp:zorba has been updated. Status: Approved => Needs review For more details, see: https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/94492 -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/94492 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
The attempt to merge lp:~zorba-coders/zorba/feature-uri_module into lp:zorba failed. Below is the output from the failed tests. CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message): Validation queue job feature-uri_module-2012-02-24T03-31-06.652Z is finished. The final status was: 2 tests did not succeed - changes not commited. Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/94492 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
Validation queue starting for merge proposal. Log at: http://zorbatest.lambda.nu:8080/remotequeue/feature-uri_module-2012-02-24T03-31-06.652Z/log.html -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/94492 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
Review: Approve -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/94492 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
The proposal to merge lp:~zorba-coders/zorba/feature-uri_module into lp:zorba has been updated. Status: Needs review => Approved For more details, see: https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/94492 -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/94492 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/feature-uri_module into lp:zorba
Matthias Brantner has proposed merging lp:~zorba-coders/zorba/feature-uri_module into lp:zorba. Requested reviews: Matthias Brantner (matthias-brantner) Chris Hillery (ceejatec) For more details, see: https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/94492 A new module that provides URL-related functions. Currently, it provides functions to do URL-decoding but other URL-related functions (e.g. to retrieve the scheme or path) will be added later. -- https://code.launchpad.net/~zorba-coders/zorba/feature-uri_module/+merge/94492 Your team Zorba Coders is subscribed to branch lp:zorba. === modified file 'ChangeLog' --- ChangeLog 2012-02-23 16:41:10 + +++ ChangeLog 2012-02-24 03:29:18 + @@ -12,6 +12,7 @@ * Added %ann:cache and %ann:no-cache to enable or disable caching of results of functions with atomic parameter and return types. * Fixed bug 917923 (bug in copying outer var values into the eval dynamic context) * Fixed bug 924063 (sentence is incorrectly incremented when token characters end without sentence terminator) + * New URI module providing percent-decoding functions. * Optimization: change the implementation of the free-vars annotation and got rid of the annotations map in expressions. * Fixed bug 909126 (bug in cloning of var_expr) === modified file 'modules/com/zorba-xquery/www/modules/CMakeLists.txt' --- modules/com/zorba-xquery/www/modules/CMakeLists.txt 2012-02-16 14:11:02 + +++ modules/com/zorba-xquery/www/modules/CMakeLists.txt 2012-02-24 03:29:18 + @@ -63,6 +63,8 @@ URI "http://www.zorba-xquery.com/modules/schema";) DECLARE_ZORBA_MODULE(FILE string.xq VERSION 2.1 URI "http://www.zorba-xquery.com/modules/string";) +DECLARE_ZORBA_MODULE(FILE uri.xq VERSION 1.0 + URI "http://www.zorba-xquery.com/modules/uri";) DECLARE_ZORBA_MODULE(FILE xml.xq VERSION 2.0 URI "http://www.zorba-xquery.com/modules/xml";) DECLARE_ZORBA_MODULE(FILE xqdoc.xq VERSION 2.0 === added file 'modules/com/zorba-xquery/www/modules/uri.xq' --- modules/com/zorba-xquery/www/modules/uri.xq 1970-01-01 00:00:00 + +++ modules/com/zorba-xquery/www/modules/uri.xq 2012-02-24 03:29:18 + @@ -0,0 +1,96 @@ +xquery version "1.0"; + +(: + : Copyright 2006-2012 The FLWOR Foundation. + : + : Licensed under the Apache License, Version 2.0 (the "License"); + : you may not use this file except in compliance with the License. + : You may obtain a copy of the License at + : + : http://www.apache.org/licenses/LICENSE-2.0 + : + : Unless required by applicable law or agreed to in writing, software + : distributed under the License is distributed on an "AS IS" BASIS, + : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + : See the License for the specific language governing permissions and + : limitations under the License. +:) + +(:~ + : This module provides string related functions. + : + : @author Matthias Brantner + : @project XDM/atomic + : + :) +module namespace uri = "http://www.zorba-xquery.com/modules/uri";; + +declare namespace zerr = "http://www.zorba-xquery.com/errors";; + +declare namespace ver = "http://www.zorba-xquery.com/options/versioning";; +declare option ver:module-version "1.0"; + +(:~ + : Percent-decodes (aka URL decoding) the given string. + : + : All percent encoded octets will be translated into their + : decoded UTF-8 representation. + : + : @param $s the string to decode + : + : @return the percent decoded string + :) +declare function uri:decode($u as xs:string) as xs:string +{ + uri:decode($u, fn:false()) +}; + +(:~ + : Percent-decodes (aka URL decoding) the given string. + : + : All percent encoded octets will be translated into their + : decoded UTF-8 representation. + : + : If $decode-plus is specified all occurrences of the char '+' + : will be replaced with a space ' ' before the percent decoding + : happens. + : + : @param $s the string to decode + : @param $decode-plus whether '+' chars will be replaced with spaces + : + : @return the percent decoded string + :) +declare function uri:decode( + $u as xs:string, + $decode-plus as xs:boolean) as xs:string +{ + uri:decode($u, $decode-plus, "UTF-8") +}; + +(:~ + : Percent-decodes (aka URL decoding) the given string. + : + : All percent encoded octets will be translated into their + : decoded UTF-8 representation. + : + : If $decode-plus is specified all occurrences of the char '+' + : will be replaced with a space ' ' before the percent decoding + : happens. + : + : The $charset parameter specifies the source charset after precent + : decoding. It is used to convert the decoded string into UTF-8. + : + : @param $s the string to decode + : @param $decode-plus whether '+' chars will be replaced with spaces + : @param $charset the source charset of the string after percent decoding + : + : @return the percent decoded string + : + : @error zerr:ZXQP0006 if the given charset is unknown or not supported + : + : @error zerr:ZOSE0006 if there is an error trans