Merge lp:~zorba-coders/zorba/bug-1188033 into lp:zorba/archive-module

Proposed by Luis Rodriguez Gonzalez
Status: Merged
Merged at revision: 52
Proposed branch: lp:~zorba-coders/zorba/bug-1188033
Merge into: lp:zorba/archive-module
Diff against target: 1647 lines (+375/-434)
47 files modified
src/CMakeLists.txt (+1/-4)
src/archive.xsd (+0/-105)
src/archive_module.xq (+103/-87)
src/archive_module.xq.src/archive_module.cpp (+168/-153)
src/archive_module.xq.src/archive_module.h (+24/-4)
test/ExpQueryResults/entries_01.xml.res (+1/-2)
test/ExpQueryResults/entries_02.xml.res (+1/-2)
test/ExpQueryResults/entries_03.xml.res (+1/-1)
test/ExpQueryResults/options_01.xml.res (+1/-2)
test/ExpQueryResults/options_02.xml.res (+1/-2)
test/Queries/create_01.xq (+4/-3)
test/Queries/create_02.xq (+2/-2)
test/Queries/create_03.spec (+1/-1)
test/Queries/create_03.xq (+3/-2)
test/Queries/delete_01.xq (+1/-1)
test/Queries/delete_02.xq (+1/-2)
test/Queries/delete_03.xq (+5/-5)
test/Queries/delete_04.xq (+5/-5)
test/Queries/dir_01.xq (+3/-3)
test/Queries/dir_02.xq (+3/-3)
test/Queries/dir_03.xq (+3/-3)
test/Queries/dir_04.xq (+4/-4)
test/Queries/entries_01.xq (+4/-3)
test/Queries/entries_02.xq (+2/-3)
test/Queries/entries_03.spec (+1/-1)
test/Queries/entries_03.xq (+4/-3)
test/Queries/entries_04.spec (+1/-1)
test/Queries/entries_04.xq (+4/-3)
test/Queries/extract_01.xq (+1/-2)
test/Queries/extract_02.xq (+1/-1)
test/Queries/extract_03.spec (+1/-1)
test/Queries/extract_03.xq (+1/-1)
test/Queries/extract_04.xq (+1/-1)
test/Queries/extract_05.xq (+4/-4)
test/Queries/extract_06.xq (+1/-1)
test/Queries/extract_07.xq (+2/-2)
test/Queries/options_01.xq (+1/-1)
test/Queries/options_02.spec (+1/-1)
test/Queries/options_02.xq (+1/-1)
test/Queries/options_03.spec (+1/-1)
test/Queries/options_03.xq (+1/-1)
test/Queries/update_01.xq (+1/-1)
test/Queries/update_02.xq (+1/-1)
test/Queries/update_03.spec (+1/-1)
test/Queries/update_03.xq (+1/-1)
test/Queries/update_04.spec (+1/-1)
test/Queries/update_04.xq (+1/-1)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-1188033
Reviewer Review Type Date Requested Status
Luis Rodriguez Gonzalez Approve
Chris Hillery Approve
Review via email: mp+176523@code.launchpad.net

Commit message

JSONiqfication for Archive Module Done.

To post a comment you must log in.
lp:~zorba-coders/zorba/bug-1188033 updated
52. By Luis Rodriguez Gonzalez

Merge with trunk and resolved conflicts

Revision history for this message
Chris Hillery (ceejatec) wrote :

In archive_module.cpp:

1. Please don't leave commented-out code. Just delete it; it's in the version history if we ever need to refer back to it. For example, remove these lines:

+ //Item lNameItem = theFactory->createString(lName);
+ //lMemberName = theFactory->createString("name");

2. As discussed, if possible, create single zorba::Items for all the JSON object key strings, eg. "name", "size", etc. Possibly create those in the ArchiveModule constructor. Use those constants when creating JSON objects in EntriesIterator::next(), as well as comparing input values in ArchiveEntry::setValues() (and anywhere else it happens to be appropriate).

Also don't forget to assign a bug to yourself to create a JSON schema for this module, and to go back and update the module and test cases accordingly.

review: Needs Fixing
Revision history for this message
Chris Hillery (ceejatec) wrote :

Also, you have at least one </p> typo in archive.xq.

Always remember to run

  ctest -R moduleDocumentation

before committing, to be sure that your XQDoc is syntactically correct and that you didn't forget to document any parameters, etc.

review: Needs Fixing
lp:~zorba-coders/zorba/bug-1188033 updated
53. By Luis Rodriguez Gonzalez

All comments fixed

54. By Luis Rodriguez Gonzalez

Removed commented code

Revision history for this message
Luis Rodriguez Gonzalez (kuraru) wrote :

> In archive_module.cpp:
>
> 1. Please don't leave commented-out code. Just delete it; it's in the version
> history if we ever need to refer back to it. For example, remove these lines:
>
> + //Item lNameItem = theFactory->createString(lName);
> + //lMemberName = theFactory->createString("name");
>
>
> 2. As discussed, if possible, create single zorba::Items for all the JSON
> object key strings, eg. "name", "size", etc. Possibly create those in the
> ArchiveModule constructor. Use those constants when creating JSON objects in
> EntriesIterator::next(), as well as comparing input values in
> ArchiveEntry::setValues() (and anywhere else it happens to be appropriate).
>
>
> Also don't forget to assign a bug to yourself to create a JSON schema for this
> module, and to go back and update the module and test cases accordingly.

Done.

Revision history for this message
Luis Rodriguez Gonzalez (kuraru) wrote :

> Also, you have at least one </p> typo in archive.xq.
>
> Always remember to run
>
> ctest -R moduleDocumentation
>
> before committing, to be sure that your XQDoc is syntactically correct and
> that you didn't forget to document any parameters, etc.

Done.

Revision history for this message
Chris Hillery (ceejatec) wrote :

You didn't actually create singleton zorba::Items for the JSON object key strings. Using C++ #defines isn't the same. This code will still create a separate zorba::Item for the string "name" for every single entry in every archive passed to a:entries().

review: Needs Fixing
Revision history for this message
Luis Rodriguez Gonzalez (kuraru) wrote :

> You didn't actually create singleton zorba::Items for the JSON object key
> strings. Using C++ #defines isn't the same. This code will still create a
> separate zorba::Item for the string "name" for every single entry in every
> archive passed to a:entries().

I used #defines only for the strings that are into the Item, I tried to create static Items into ArchiveModule but at the end I got some linker errors at execution time, I did some research but couldn't fix it so I moved the Items to be created in EntriesIterator and OptionsIterator that in theory created only once insstead of creating one for each entry and options. I will upload a version with the Items created in ArchiveModule and if you have a chance pleaase take a look and let me know if you know how to fix it.

lp:~zorba-coders/zorba/bug-1188033 updated
55. By Luis Rodriguez Gonzalez

Testing global Items for Entries

56. By Chris Hillery

Definition of globalFormatName.

57. By Luis Rodriguez Gonzalez

Changes to have global Items from ArchiveModule class made

Revision history for this message
Chris Hillery (ceejatec) wrote :

Global Items code looks good now!

As a general rule, don't put actual function definitions into header files. Certain small methods (accessors, usually) can be inline for efficiency, but anything more significant can cause code bloat and other problems. I moved the ArchiveModule() constructor definition into archive_module.cpp. With that done, everything looks fine.

review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/bug-1188033/+merge/176523

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting criteria failed for the following merge proposals:

https://code.launchpad.net/~zorba-coders/zorba/bug-1188033/+merge/176523 :
Votes: {'Approve': 1, 'Pending': 1, 'Needs commit message': 1}

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/bug-1188033/+merge/176523

Stage "CommitZorba" failed.

Check console output at http://jenkins.lambda.nu/job/CommitZorba/66/console to view the results.

Revision history for this message
Luis Rodriguez Gonzalez (kuraru) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/bug-1188033/+merge/176523

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting criteria failed for the following merge proposals:

https://code.launchpad.net/~zorba-coders/zorba/bug-1188033/+merge/176523 :
Votes: {'Approve': 2, 'Needs commit message': 1}

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/bug-1188033/+merge/176523

Stage "CommitZorba" failed.

Check console output at http://jenkins.lambda.nu/job/CommitZorba/68/console to view the results.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/bug-1188033/+merge/176523

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue succeeded - proposal merged!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2012-07-27 03:43:13 +0000
+++ src/CMakeLists.txt 2013-07-29 19:28:26 +0000
@@ -17,11 +17,8 @@
17INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/archive_module.xq.src")17INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/archive_module.xq.src")
18 18
19DECLARE_ZORBA_MODULE (19DECLARE_ZORBA_MODULE (
20 URI "http://www.zorba-xquery.com/modules/archive"20 URI "http://zorba.io/modules/archive"
21 VERSION 1.021 VERSION 1.0
22 FILE "archive_module.xq"22 FILE "archive_module.xq"
23 LINK_LIBRARIES "${LIBARCHIVE_LIBRARIES}")23 LINK_LIBRARIES "${LIBARCHIVE_LIBRARIES}")
2424
25DECLARE_ZORBA_SCHEMA (
26 URI "http://www.zorba-xquery.com/modules/archive"
27 FILE "archive.xsd")
2825
=== removed file 'src/archive.xsd'
--- src/archive.xsd 2012-09-06 20:40:47 +0000
+++ src/archive.xsd 1970-01-01 00:00:00 +0000
@@ -1,105 +0,0 @@
1<?xml version="1.0"?>
2
3<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
4 targetNamespace="http://www.zorba-xquery.com/modules/archive"
5 xmlns="http://www.zorba-xquery.com/modules/archive"
6 elementFormDefault="qualified"
7 attributeFormDefault="unqualified">
8
9 <xs:simpleType name="compression-type">
10 <xs:restriction base="xs:string">
11 <xs:enumeration value="store"/>
12 <xs:enumeration value="deflate"/>
13 <xs:enumeration value="bzip2"/>
14 <xs:enumeration value="lzma"/>
15 <xs:enumeration value="STORE"/>
16 <xs:enumeration value="DEFLATE"/>
17 <xs:enumeration value="BZIP2"/>
18 <xs:enumeration value="LZMA"/>
19 </xs:restriction>
20 </xs:simpleType>
21
22 <xs:simpleType name="format-type">
23 <xs:restriction base="xs:string">
24 <xs:enumeration value="zip"/>
25 <xs:enumeration value="tar"/>
26 <xs:enumeration value="pax"/>
27 <xs:enumeration value="ZIP"/>
28 <xs:enumeration value="TAR"/>
29 <xs:enumeration value="PAX"/>
30 </xs:restriction>
31 </xs:simpleType>
32
33 <xs:simpleType name="boolean-type">
34 <xs:restriction base="xs:string">
35 <xs:enumeration value="true"/>
36 <xs:enumeration value="false"/>
37 </xs:restriction>
38 </xs:simpleType>
39
40 <xs:simpleType name="entry-name-type">
41 <xs:restriction base="xs:string"/>
42 </xs:simpleType>
43
44 <xs:simpleType name="entry-datetime-type">
45 <xs:restriction base="xs:dateTime"/>
46 </xs:simpleType>
47
48 <xs:simpleType name="entry-size-type">
49 <xs:restriction base="xs:short"/>
50 </xs:simpleType>
51
52 <xs:simpleType name="entry-encoding-type">
53 <xs:restriction base="xs:string"/>
54 </xs:simpleType>
55
56 <xs:simpleType name="entry-type">
57 <xs:restriction base="xs:string">
58 <xs:enumeration value="regular"/>
59 <xs:enumeration value="directory"/>
60 </xs:restriction>
61 </xs:simpleType>
62
63 <!-- elements -->
64 <xs:element name="archive-option-element"
65 abstract="true" type="xs:string"/>
66
67 <xs:element name="compression"
68 type="compression-type"
69 substitutionGroup="archive-option-element"/>
70
71 <xs:element name="format" type="format-type"
72 substitutionGroup="archive-option-element"/>
73
74 <xs:element name="skip-extra-attributes" type="boolean-type"
75 substitutionGroup="archive-option-element"/>
76
77 <xs:element name="options">
78 <xs:complexType>
79 <xs:sequence>
80 <xs:element ref="archive-option-element"
81 minOccurs="0" maxOccurs="unbounded"/>
82 </xs:sequence>
83 </xs:complexType>
84 </xs:element>
85
86 <xs:element name="entry">
87 <xs:complexType>
88 <xs:simpleContent>
89 <xs:extension base="entry-name-type">
90 <xs:attributeGroup ref="entry-attributes"/>
91 </xs:extension>
92 </xs:simpleContent>
93 </xs:complexType>
94 </xs:element>
95
96 <!-- entry attributes -->
97 <xs:attributeGroup name="entry-attributes">
98 <xs:attribute name="type" type="entry-type"/>
99 <xs:attribute name="size" type="entry-size-type"/>
100 <xs:attribute name="last-modified" type="entry-datetime-type"/>
101 <xs:attribute name="encoding" type="entry-encoding-type"/>
102 <xs:attribute name="compression" type="compression-type"/>
103 </xs:attributeGroup>
104
105</xs:schema>
1060
=== modified file 'src/archive_module.xq'
--- src/archive_module.xq 2012-12-21 22:10:19 +0000
+++ src/archive_module.xq 2013-07-29 19:28:26 +0000
@@ -1,4 +1,4 @@
1xquery version "1.0";1jsoniq version "1.0";
22
3(:3(:
4 : Copyright 2012 The FLWOR Foundation.4 : Copyright 2012 The FLWOR Foundation.
@@ -17,62 +17,62 @@
17 :)17 :)
1818
19(:~19(:~
20 : <p>This module provides functionality to work with (possibly compressed)20 : This module provides functionality to work with (possibly compressed)
21 : archives. For example, it provides functions to retrieve the names or21 : archives. For example, it provides functions to retrieve the names or
22 : extract the values of several entries in a ZIP archive. Moreover,22 : extract the values of several entries in a ZIP archive. Moreover,
23 : there exist functions that allow to create or update archives.</p>23 : there exist functions that allow to create or update archives.<p/>
24 :24 :
25 : <p>The following archive formats and compression algorithms are supported:25 : The following archive formats and compression algorithms are supported:
26 : <ul>26 : <ul>
27 : <li>ZIP (with compression DEFLATE or STORE)</li>27 : <li>ZIP (with compression DEFLATE or STORE)</li>
28 : <li>TAR (with compression GZIP)</li>28 : <li>TAR (with compression GZIP)</li>
29 : </ul>29 : </ul>
30 : </p>30 : <p/>
31 : 31 :
32 : @author Luis Rodgriguez, Juan Zacarias, and Matthias Brantner32 : @author Luis Rodgriguez, Juan Zacarias, and Matthias Brantner
33 :33 :
34 : @library <a href="http://code.google.com/p/libarchive/">libarchive</a>34 : @library <a href="http://code.google.com/p/libarchive/">libarchive</a>
35 : @project Zorba/Archive35 : @project Zorba/Archive
36 :)36 :)
37module namespace a = "http://www.zorba-xquery.com/modules/archive";37module namespace a = "http://zorba.io/modules/archive";
38 38
39import schema namespace options = "http://www.zorba-xquery.com/modules/archive";
40
41declare namespace ver = "http://www.zorba-xquery.com/options/versioning";39declare namespace ver = "http://www.zorba-xquery.com/options/versioning";
42declare option ver:module-version "1.0";40declare option ver:module-version "1.0";
43 41
44(:~42(:~
45 : Creates a new ZIP archive out of the given entries and contents.43 : Creates a new ZIP archive out of the given entries and contents. <p/>
46 :44 :
47 : <p>All entries are compressed with the DEFLATE compression algorithm.</p>45 : All entries are compressed with the DEFLATE compression algorithm.<p/>
48 : 46 :
49 : <p>The parameters $entries and $contents have the same meaning as for47 : The parameters $entries and $contents have the same meaning as for
50 : the function a:create with three arguments.</p>48 : the function a:create with three arguments.<p/>
51 :49 :
52 : <p>Entry entries can include a type attribute, this attribute can have one50 : Entry entries can include a type element, this element can have one
53 : of two possible values: "regular" or "directory". If "regular" is51 : of two possible values: "regular" or "directory". If "regular" is
54 : specified then the entry will be created as a regular file; if "directory"52 : specified then the entry will be created as a regular file; if "directory"
55 : is specified then the entry will be created as a directory, no contents53 : is specified then the entry will be created as a directory, no contents
56 : will be read from $contents in this case. If no value is specified for type54 : will be read from $contents in this case. If no value is specified for type
57 : then it will be set to "regular". Example:55 : then it will be set to "regular". <p/>
56 : Example:
58 : <pre>57 : <pre>
59 : $zip-file := a:create(58 : $zip-file := a:create(
60 : (&lt;a:entry encoding="ISO-8859-1" type="directory">dir1&lt;/a:entry>, "dir1/file1"),59 : ({ "encoding" : "ISO-8859-1", "type" : "directory", "name" : "dir1" }, "dir1/file1"),
61 : ("file contents"))60 : ("file contents"))
62 : </pre>61 : </pre>
63 : </p>62 : <p/>
64 :63 :
65 : @param $entries the meta data for the entries in the archive. Each entry64 : @param $entries the meta data for the entries in the archive. Each entry
66 : can be of type xs:string or an element with name a:entry.65 : can be of type xs:string or a JSON oibject describing the entry.
67 : @param $contents the content for the archive. Each item in the sequence66 : @param $contents the content for the archive. Each item in the sequence
68 : can be of type xs:string or xs:base64Binary.67 : can be of type xs:string or xs:base64Binary.
69 :68 :
70 : @return the generated archive as xs:base64Binary69 : @return the generated archive as xs:base64Binary
71 :70 :
72 : @error a:ARCH0001 if the number of entry elements differs from the number71 : @error a:ENTRY-COUNT-MISMATCH if the number of entries that don't describe directories
73 : of items in the $contents sequence: count($entries) ne count($contents)72 : differs from the number of items in the $contents sequence:
74 : @error a:ARCH0003 if a value for an entry element is invalid73 : count($non-directory-entries) ne count($contents)
75 : @error a:ARCH0004 if a given encoding is invalid or not supported74 : @error a:INVALID-ENTRY-VALS if a values in an entry object are invalid
75 : @error a:INVALID-ENCODING if a given encoding is invalid or not supported
76 : @error err:FORG0006 if an item in the contents sequence is not of type xs:string76 : @error err:FORG0006 if an item in the contents sequence is not of type xs:string
77 : or xs:base64Binary77 : or xs:base64Binary
78 :)78 :)
@@ -82,94 +82,106 @@
82 as xs:base64Binary external;82 as xs:base64Binary external;
83 83
84(:~84(:~
85 : Creates a new archive out of the given entries and contents.85 : Creates a new archive out of the given entries and contents. <p/>
86 :86 :
87 : <p>The $entries arguments provides meta data for each entry in the archive.87 : The $entries arguments provides meta data for each entry in the archive.
88 : For example, the name of the entry (mandatory) or the last-modified date88 : For example, the name of the entry (mandatory) or the last-modified date
89 : (optional). An entry can either be of type xs:string to describe the entry89 : (optional). An entry can either be of type xs:string to describe the entry
90 : name or of type xs:base64Binary to provide additional meta data.</p>90 : name or of type xs:base64Binary to provide additional meta data.<p/>
91 :91 :
92 : <p>The $contents sequence provides the data (xs:string or xs:base64Binary) for92 : The $contents sequence provides the data (xs:string or xs:base64Binary) for
93 : the entries that should be included in the archive. Its length needs to93 : the entries that should be included in the archive. Its length needs to
94 : match the length of the $entries sequence (a:ARCH0001). All items of type94 : match the length of the entries in the $entries sequence that don't describe
95 : xs:base64Binary are decoded before being added to the archive.</p>95 : directory entries (a:ARCH0001). All items of type xs:base64Binary are decoded
96 : before being added to the archive.<p/>
96 :97 :
97 : <p>For each entry, the name, last-modified date and time, and compression98 : For each entry, the name, last-modified date and time, and compression
98 : can be specified. In addition, an encoding can be specified which is used to99 : can be specified. In addition, an encoding can be specified which is used to
99 : store entries of type xs:string. If no last-modified attribute is given, the100 : store entries of type xs:string. If no last-modified attribute is given, the
100 : default is the current date and time. The compression is useful if various101 : default is the current date and time. The compression is useful if various
101 : entries in a ZIP archive are compressed using different compression102 : entries in a ZIP archive are compressed using different compression
102 : algorithms (i.e. store or deflate).</p>103 : algorithms (i.e. store or deflate).<p/>
103 :104 :
104 : <p>For example, the following sequence may be used to describe an archive105 : For example, the following sequence may be used to describe an archive
105 : containing three elements:106 : containing two elements: <p/>
106 : <pre class="ace-static" ace-mode="xquery"><![CDATA[&lt;a:entry last-modified="{fn:current-dateTime()}">myfile.txt&lt;/a:entry>107 : <pre class="ace-static" ace-mode="xquery">{
107 : &lt;a:entry encoding="ISO-8859-1" compression="store">dir/myfile.xml&lt;/a:entry>]]>108 : "last-modified" : "{fn:current-dateTime()}"
109 : "name" : "myfile.txt"
110 : },
111 : {
112 : "encoding" : "ISO-8859-1",
113 : "compression" : "store",
114 : "name" : "dir/myfile.xml"
115 : }
108 : </pre>116 : </pre>
109 : </p>117 : <p/>
110 :118 :
111 : <p>The $options argument may be used to describe general options for the119 : The $options argument may be used to describe general options for the
112 : archive. For example, the following option element can be used to create a ZIP120 : archive. For example, the following options can be used to create a ZIP
113 : archive in which all entries are compressed with the DEFLATE compression121 : archive in which all entries are compressed with the DEFLATE compression
114 : algorithm:122 : algorithm: <p/>
115 : <pre class="ace-static" ace-mode="xquery"><![CDATA[&lt;archive:options>123 : <pre class="ace-static" ace-mode="xquery">{
116 : &lt;archive:format>ZIP&lt;/archive:format>124 : "format" : "ZIP",
117 : &lt;archive:compression>DEFLATE&lt;/archive:compression>125 : "compression" : "DEFLATE"
118 : &lt;/archive:options>]]>126 : }
119 : </pre>127 : </pre>
120 : </p>128 : <p/>
121 :129 :
122 : <p>The result of the function is the generated archive as a item of type130 : The result of the function is the generated archive as a item of type
123 : xs:base64Binary.</p>131 : xs:base64Binary.<p/>
124 :132 :
125 :133 :
126 : @param $entries the meta data for the entries in the archive. Each entry134 : @param $entries the meta data for the entries in the archive. Each entry
127 : can be of type xs:string or an element with name a:entry.135 : can be of type xs:string or an JSON object describing the entry.
128 : @param $contents the content for the archive. Each item in the sequence136 : @param $contents the content for the archive. Each item in the sequence
129 : can be of type xs:string or xs:base64Binary.137 : can be of type xs:string or xs:base64Binary.
130 : @param $options the options used to generate the archive.138 : @param $options the options used to generate the archive.
131 :139 :
132 : @return the generated archive as xs:base64Binary140 : @return the generated archive as xs:base64Binary
133 :141 :
134 : @error a:ARCH0001 if the number of entry elements differs from the number142 : @error a:ENTRY-COUNT-MISMATCH if the number of entries describing non-directories differs
135 : of items in the $contents sequence: count($entries) ne count($contents)143 : from the number of items in the $contents sequence:
136 : @error a:ARCH0002 if the options argument contains invalid values144 : count($non-directoy-entries) ne count($contents)
137 : @error a:ARCH0003 if a value for an entry element is invalid145 : @error a:INVALID-OPTIONS if the options argument contains invalid values
138 : @error a:ARCH0004 if a given encoding is invalid or not supported146 : @error a:INVALID-ENTRY-VALS if any values in an entry are invalid
147 : @error a:INVALID-ENCODING if a given encoding is invalid or not supported
148 : @error a:DIFFERENT-COMPRESSIONS-NOT-SUPPORTED if different compression algorithms
149 : were selected but the actual version of libarchive doesn't support it.
139 : @error err:FORG0006 if an item in the contents sequence is not of type xs:string150 : @error err:FORG0006 if an item in the contents sequence is not of type xs:string
140 : or xs:base64Binary151 : or xs:base64Binary
141 :)152 :)
142declare function a:create(153declare function a:create(
143 $entries as item()*,154 $entries as item()*,
144 $contents as item()*,155 $contents as item()*,
145 $options as element(a:options))156 $options as object())
146 as xs:base64Binary external; 157 as xs:base64Binary external;
147 158
148(:~159(:~
149 : Returns the header information of all entries in the given archive.160 : Returns the header information of all entries in the given archive as a JSON
161 : objects sequence. <p/>
150 :162 :
151 : <p>Such information includes the name of the entry, the uncompressed size,163 : Such information includes the name of the entry, the uncompressed size,
152 : as well as the last-modified timestamp. Note that not all values are164 : as well as the last-modified timestamp. Note that not all values are
153 : available in every archive.</p>165 : available in every archive.<p/>
154 :166 :
155 : @param $archive the archive to list the entries from as xs:base64Binary167 : @param $archive the archive to list the entries from as xs:base64Binary
156 :168 :
157 : @return a sequence of strings, one for each entry in the archive169 : @return a sequence of strings, one for each entry in the archive
158 :170 :
159 : @error a:ARCH9999 if $archive is not an archive or corrupted171 : @error a:CORRUPTED-ARCHIVE if $archive is not an archive or corrupted
160 :)172 :)
161declare function a:entries($archive as xs:base64Binary)173declare function a:entries($archive as xs:base64Binary)
162 as element(a:entry)* external;174 as object()* external;
163 175
164(:~176(:~
165 : Extracts the contents of all entries in the given archive as text177 : Extracts the contents of all entries in the given archive as text
166 : using UTF-8 as default encoding.178 : using UTF-8 as default encoding. <p/>
167 :179 :
168 : @param $archive the archive to extract the entries from as xs:base64Binary180 : @param $archive the archive to extract the entries from as xs:base64Binary
169 :181 :
170 : @return one string for the contents of each entry in the archive182 : @return one string for the contents of each entry in the archive
171 :183 :
172 : @error a:ARCH9999 if $archive is not an archive or corrupted184 : @error a:CORRUPTED-ARCHIVE if $archive is not an archive or corrupted
173 : @error err:FOCH0001 if any of the entries contains invalid utf-8 characters185 : @error err:FOCH0001 if any of the entries contains invalid utf-8 characters
174 :)186 :)
175declare function a:extract-text($archive as xs:base64Binary)187declare function a:extract-text($archive as xs:base64Binary)
@@ -178,7 +190,7 @@
178(:~190(:~
179 : Extracts the contets of the entries identified by a given sequence of191 : Extracts the contets of the entries identified by a given sequence of
180 : names as text.192 : names as text.
181 : The default encoding used to read the string is UTF-8.193 : The default encoding used to read the string is UTF-8. <p/>
182 :194 :
183 : @param $archive the archive to extract the entries from as xs:base64Binary195 : @param $archive the archive to extract the entries from as xs:base64Binary
184 : @param $entry-names a sequence of names for entries which should be extracted196 : @param $entry-names a sequence of names for entries which should be extracted
@@ -186,7 +198,7 @@
186 : @return a sequence of strings for the given sequence of names or the198 : @return a sequence of strings for the given sequence of names or the
187 : empty sequence if no entries match the given names.199 : empty sequence if no entries match the given names.
188 :200 :
189 : @error a:ARCH9999 if $archive is not an archive or corrupted201 : @error a:CORRUPTED-ARCHIVE if $archive is not an archive or corrupted
190 : @error err:FOCH0001 if any of the entries requested contains invalid utf-8 characters202 : @error err:FOCH0001 if any of the entries requested contains invalid utf-8 characters
191 :)203 :)
192declare function a:extract-text($archive as xs:base64Binary, $entry-names as xs:string*)204declare function a:extract-text($archive as xs:base64Binary, $entry-names as xs:string*)
@@ -194,7 +206,7 @@
194 206
195(:~207(:~
196 : Extracts the contets of the entries identified by a given sequence of208 : Extracts the contets of the entries identified by a given sequence of
197 : names as text. Each entry is treated with the given encoding.209 : names as text. Each entry is treated with the given encoding. <p/>
198 :210 :
199 : @param $archive the archive to extract the entries from as xs:base64Binary211 : @param $archive the archive to extract the entries from as xs:base64Binary
200 : @param $entry-names a sequence of entry names that should be extracted212 : @param $entry-names a sequence of entry names that should be extracted
@@ -203,8 +215,8 @@
203 : @return a sequence of strings for the given sequence of names or the215 : @return a sequence of strings for the given sequence of names or the
204 : empty sequence if no entries match the given names.216 : empty sequence if no entries match the given names.
205 :217 :
206 : @error a:ARCH9999 if $archive is not an archive or corrupted218 : @error a:CORRUPTED-ARCHIVE if $archive is not an archive or corrupted
207 : @error a:ARCH0004 if the given $encoding is invalid or not supported219 : @error a:INVALID-ENCODING if the given $encoding is invalid or not supported
208 : @error err:FOCH0001 if a transcoding error happens220 : @error err:FOCH0001 if a transcoding error happens
209 :)221 :)
210declare function a:extract-text(222declare function a:extract-text(
@@ -215,20 +227,20 @@
215 227
216(:~228(:~
217 : Returns the entries identified by the given paths from the archive229 : Returns the entries identified by the given paths from the archive
218 : as base64Binary.230 : as base64Binary. <p/>
219 :231 :
220 : @param $archive the archive to extract the entries from as xs:base64Binary232 : @param $archive the archive to extract the entries from as xs:base64Binary
221 :233 :
222 : @return one xs:base64Binary item for the contents of each entry in the archive234 : @return one xs:base64Binary item for the contents of each entry in the archive
223 :235 :
224 : @error a:ARCH9999 if $archive is not an archive or corrupted236 : @error a:CORRUPTED-ARCHIVE if $archive is not an archive or corrupted
225 :)237 :)
226declare function a:extract-binary($archive as xs:base64Binary)238declare function a:extract-binary($archive as xs:base64Binary)
227 as xs:base64Binary* external;239 as xs:base64Binary* external;
228 240
229(:~241(:~
230 : Returns the entries identified by the given paths from the archive242 : Returns the entries identified by the given paths from the archive
231 : as base64Binary.243 : as base64Binary. <p/>
232 :244 :
233 : @param $archive the archive to extract the entries from as xs:base64Binary245 : @param $archive the archive to extract the entries from as xs:base64Binary
234 :246 :
@@ -237,66 +249,70 @@
237 : @return a sequence of xs:base64Binary itmes for the given sequence of names249 : @return a sequence of xs:base64Binary itmes for the given sequence of names
238 : or the empty sequence if no entries match the given names.250 : or the empty sequence if no entries match the given names.
239 :251 :
240 : @error a:ARCH9999 if $archive is not an archive or corrupted252 : @error a:CORRUPTED-ARCHIVE if $archive is not an archive or corrupted
241 :)253 :)
242declare function a:extract-binary($archive as xs:base64Binary, $entry-names as xs:string*)254declare function a:extract-binary($archive as xs:base64Binary, $entry-names as xs:string*)
243 as xs:base64Binary* external;255 as xs:base64Binary* external;
244 256
245(:~257(:~
246 : Adds and replaces entries in an archive according to258 : Adds and replaces entries in an archive according to
247 : the given spec. The contents can be string and base64Binary items.259 : the given spec. The contents can be string and base64Binary items. <p/>
248 :260 :
249 : <p>The parameters $entries and $contents have the same meaning as for261 : The parameters $entries and $contents have the same meaning as for
250 : the function a:create with three arguments.</p>262 : the function a:create with three arguments.<p/>
251 : 263 :
252 : @param $archive the archive to add or replace content264 : @param $archive the archive to add or replace content
253 : @param $entries the meta data for the entries in the archive. Each entry265 : @param $entries the meta data for the entries in the archive. Each entry
254 : can be of type xs:string or an element with name a:entry.266 : can be of type xs:string or a JSON object. For mandatory fields in the
267 : JSON object see create function.
255 : @param $contents the content for the archive. Each item in the sequence268 : @param $contents the content for the archive. Each item in the sequence
256 : can be of type xs:string or xs:base64Binary.269 : can be of type xs:string or xs:base64Binary.
257 : 270 :
258 : @return the updated xs:base64Binary271 : @return the updated xs:base64Binary
259 :272 :
260 : @error a:ARCH0001 if the number of entry elements differs from the number273 : @error a:ENTRY-COUNT-MISMATCH if the number of entry elements differs from the number
261 : of items in the $contents sequence: count($entries) ne count($contents) 274 : of items in the $contents sequence: count($non-directory-entries) ne count($contents)
262 : @error a:ARCH0003 if a value for an entry element is invalid275 : @error a:INVALID-ENTRY-VALS if a value for an entry element is invalid
263 : @error a:ARCH0004 if a given encoding is invalid or not supported276 : @error a:INVALID-ENCODING if a given encoding is invalid or not supported
277 : @error a:DIFFERENT-COMPRESSIONS-NOT-SUPPORTED if different compression algorithms
278 : were selected but the actual version of libarchive doesn't support it.
264 : @error err:FORG0006 if an item in the contents sequence is not of type xs:string279 : @error err:FORG0006 if an item in the contents sequence is not of type xs:string
265 : or xs:base64Binary280 : or xs:base64Binary
266 : @error a:ARCH9999 if $archive is not an archive or corrupted281 : @error a:CORRUPTED-ARCHIVE if $archive is not an archive or corrupted
267 :282 :
268 :)283 :)
269declare function a:update($archive as xs:base64Binary, $entries as item()*, $contents as item()*)284declare function a:update($archive as xs:base64Binary, $entries as item()*, $contents as item()*)
270 as xs:base64Binary external;285 as xs:base64Binary external;
271 286
272(:~287(:~
273 : Deletes entries from an archive.288 : Deletes entries from an archive. <p/>
274 :289 :
275 : @param $archive the archive to extract the entries from as xs:base64Binary290 : @param $archive the archive to extract the entries from as xs:base64Binary
276 : @param $entry-names a sequence of names for entries which should be deleted291 : @param $entry-names a sequence of names for entries which should be deleted
277 : 292 :
278 : @return the updated base64Binary293 : @return the updated base64Binary
279 :294 :
280 : @error a:ARCH9999 if $archive is not an archive or corrupted295 : @error a:CORRUPTED-ARCHIVE if $archive is not an archive or corrupted
281 :)296 :)
282declare function a:delete($archive as xs:base64Binary, $entry-names as xs:string*)297declare function a:delete($archive as xs:base64Binary, $entry-names as xs:string*)
283 as xs:base64Binary external;298 as xs:base64Binary external;
284299
285(:~300(:~
286 : Returns the algorithm and format options of the given archive.301 : Returns the algorithm and format options as a JSON object for a given archive.
287 : For example, for a ZIP archive, the following options element302 : For example, for a ZIP archive, the following options element
288 : would be returned:303 : would be returned: <p/>
289 : <pre class="ace-static" ace-mode="xquery"><![CDATA[&lt;archive:options>304 : <pre class="ace-static" ace-mode="xquery">{
290 : &lt;archive:format>ZIP&lt;/archive:format>305 : "format" : "ZIP",
291 : &lt;archive:compressionDEFLATE&lt;/archive:compression>306 : "compression" : "DEFLATE"
292 : &lt;/archive:options>]]>307 : }
293 : </pre>308 : </pre>
309 : <p/>
294 :310 :
295 : @param $archive the archive as xs:base64Binary311 : @param $archive the archive as xs:base64Binary
296 :312 :
297 : @return the algorithm and format options313 : @return the algorithm and format options as a JSON object
298 :314 :
299 : @error a:ARCH9999 if $archive is not an archive or corrupted315 : @error a:CORRUPTED-ARCHIVE if $archive is not an archive or corrupted
300 :)316 :)
301declare function a:options($archive as xs:base64Binary)317declare function a:options($archive as xs:base64Binary)
302 as element(a:options) external;318 as object() external;
303319
=== modified file 'src/archive_module.xq.src/archive_module.cpp'
--- src/archive_module.xq.src/archive_module.cpp 2013-06-21 04:18:40 +0000
+++ src/archive_module.xq.src/archive_module.cpp 2013-07-29 19:28:26 +0000
@@ -45,8 +45,23 @@
45#include "archive_module.h"45#include "archive_module.h"
46#include "config.h"46#include "config.h"
4747
48#define ERROR_ENTRY_COUNT_MISMATCH "ENTRY-COUNT"
49#define ERROR_INVALID_OPTIONS "INVALID-OPTIONS"
50#define ERROR_INVALID_ENTRY_VALS "INVALID-ENTRY-VALS"
51#define ERROR_INVALID_ENCODING "INVALID-ENCODING"
52#define ERROR_CORRUPTED_ARCHIVE "CORRUPTED-ARCHIVE"
53#define ERROR_DIFFERENT_COMPRESSIONS_NOT_SUPPORTED "DIFFERENT-COMPRESSIONS-NOT-SUPPORTED"
54
48namespace zorba { namespace archive {55namespace zorba { namespace archive {
4956
57// Allocating global keys
58zorba::Item ArchiveModule::globalFormatKey;
59zorba::Item ArchiveModule::globalCompressionKey;
60zorba::Item ArchiveModule::globalNameKey;
61zorba::Item ArchiveModule::globalTypeKey;
62zorba::Item ArchiveModule::globalSizeKey;
63zorba::Item ArchiveModule::globalLastModifiedKey;
64zorba::Item ArchiveModule::globalEncodingKey;
5065
51/*******************************************************************************66/*******************************************************************************
52 ******************************************************************************/67 ******************************************************************************/
@@ -146,10 +161,26 @@
146 std::ostringstream lMsg;161 std::ostringstream lMsg;
147 lMsg << i.getStringValue()162 lMsg << i.getStringValue()
148 << ": invalid value for last-modified attribute ";163 << ": invalid value for last-modified attribute ";
149 ArchiveFunction::throwError("ARCH0003", lMsg.str().c_str());164 ArchiveFunction::throwError(ERROR_INVALID_ENTRY_VALS, lMsg.str().c_str());
150 }165 }
151 }166 }
152167
168 zorba::Item&
169 ArchiveModule::getGlobalItems(enum ArchiveModule::GLOBAL_ITEMS g)
170 {
171 switch(g)
172 {
173 case FORMAT: return globalFormatKey;
174 case COMPRESSION: return globalCompressionKey;
175 case NAME: return globalNameKey;
176 case TYPE: return globalTypeKey;
177 case SIZE: return globalSizeKey;
178 case LAST_MODIFIED: return globalLastModifiedKey;
179 case ENCODING: return globalEncodingKey;
180 // we should never touch the default clause but ...
181 default: return globalFormatKey;
182 }
183 }
153184
154/*******************************************************************************185/*******************************************************************************
155 ****************************** ArchiveFunction ********************************186 ****************************** ArchiveFunction ********************************
@@ -209,34 +240,36 @@
209 void240 void
210 ArchiveFunction::ArchiveEntry::setValues(zorba::Item& aEntry)241 ArchiveFunction::ArchiveEntry::setValues(zorba::Item& aEntry)
211 {242 {
212 theEntryPath = aEntry.getStringValue();243 if (aEntry.isJSONItem())
213
214 if (aEntry.isNode())
215 {244 {
216 Item lAttr;245 Item lKey;
217246
218 Iterator_t lAttrIter = aEntry.getAttributes();247 Iterator_t lKeyIter = aEntry.getObjectKeys();
219 lAttrIter->open();248 lKeyIter->open();
220 while (lAttrIter->next(lAttr))249 while (lKeyIter->next(lKey))
221 {250 {
222 Item lAttrName;251 Item lKeyValue;
223 lAttr.getNodeName(lAttrName);252 lKeyValue = aEntry.getObjectValue(lKey.getStringValue());
224253
225 if(lAttrName.getLocalName() == "type")254 if(lKey.getStringValue() == ArchiveModule::getGlobalItems(ArchiveModule::NAME).getStringValue())
226 {255 {
227 String filetype = lAttr.getStringValue();256 theEntryPath = lKeyValue.getStringValue();
257 }
258 else if(lKey.getStringValue() == ArchiveModule::getGlobalItems(ArchiveModule::TYPE).getStringValue())
259 {
260 String filetype = lKeyValue.getStringValue();
228 if(filetype == "directory")261 if(filetype == "directory")
229 {262 {
230 theEntryType = directory;263 theEntryType = directory;
231 }264 }
232 }265 }
233 else if (lAttrName.getLocalName() == "last-modified")266 else if (lKey.getStringValue() == ArchiveModule::getGlobalItems(ArchiveModule::LAST_MODIFIED).getStringValue())
234 {267 {
235 ArchiveModule::parseDateTimeItem(lAttr, theLastModified);268 ArchiveModule::parseDateTimeItem(lKeyValue, theLastModified);
236 }269 }
237 else if (lAttrName.getLocalName() == "encoding")270 else if (lKey.getStringValue() == ArchiveModule::getGlobalItems(ArchiveModule::ENCODING).getStringValue())
238 {271 {
239 theEncoding = lAttr.getStringValue();272 theEncoding = lKeyValue.getStringValue();
240 std::transform(273 std::transform(
241 theEncoding.begin(), theEncoding.end(),274 theEncoding.begin(), theEncoding.end(),
242 theEncoding.begin(), ::toupper);275 theEncoding.begin(), ::toupper);
@@ -245,19 +278,24 @@
245 std::ostringstream lMsg;278 std::ostringstream lMsg;
246 lMsg << theEncoding << ": unsupported encoding";279 lMsg << theEncoding << ": unsupported encoding";
247 280
248 throwError("ARCH0004", lMsg.str().c_str());281 throwError(ERROR_INVALID_ENCODING, lMsg.str().c_str());
249 }282 }
250 }283 }
251 else if (lAttrName.getLocalName() == "compression")284 else if (lKey.getStringValue() == ArchiveModule::getGlobalItems(ArchiveModule::COMPRESSION).getStringValue())
252 {285 {
253 theCompression = lAttr.getStringValue();286 theCompression = lKeyValue.getStringValue();
254 std::transform(287 std::transform(
255 theCompression.begin(),288 theCompression.begin(),
256 theCompression.end(),289 theCompression.end(),
257 theCompression.begin(), ::toupper);290 theCompression.begin(), ::toupper);
258 }291 }
292 else if (lKey.getStringValue() == ArchiveModule::getGlobalItems(ArchiveModule::SIZE).getStringValue())
293 {
294 theSize = lKeyValue.getLongValue();
295 }
259 }296 }
260 }297 } else
298 theEntryPath = aEntry.getStringValue();
261 }299 }
262300
263 /********************301 /********************
@@ -281,66 +319,67 @@
281 void319 void
282 ArchiveFunction::ArchiveOptions::setValues(Item& aOptions)320 ArchiveFunction::ArchiveOptions::setValues(Item& aOptions)
283 {321 {
284 Item lOption;322 if(aOptions.isJSONItem())
285323 {
286 Iterator_t lOptionIter = aOptions.getChildren();324 Item lOptionKey;
287 lOptionIter->open();325 Iterator_t lKeyIter = aOptions.getObjectKeys();
288326 lKeyIter->open();
289 while (lOptionIter->next(lOption))327
290 {328 while (lKeyIter->next(lOptionKey))
291 Item lOptionName;329 {
292 lOption.getNodeName(lOptionName);330 Item lOptionValue;
293331 lOptionValue = aOptions.getObjectValue(lOptionKey.getStringValue());
294 if (lOptionName.getLocalName() == "compression")332
295 {333 if (lOptionKey.getStringValue() == ArchiveModule::getGlobalItems(ArchiveModule::COMPRESSION).getStringValue())
296 theCompression = lOption.getStringValue().c_str();334 {
297 std::transform(335 theCompression = lOptionValue.getStringValue().c_str();
298 theCompression.begin(),336 std::transform(
299 theCompression.end(),337 theCompression.begin(),
300 theCompression.begin(), ::toupper);338 theCompression.end(),
301 }339 theCompression.begin(), ::toupper);
302 else if (lOptionName.getLocalName() == "format")340 }
303 {341 else if (lOptionKey.getStringValue() == ArchiveModule::getGlobalItems(ArchiveModule::FORMAT).getStringValue())
304 theFormat = lOption.getStringValue().c_str();342 {
305 std::transform(343 theFormat = lOptionValue.getStringValue().c_str();
306 theFormat.begin(),344 std::transform(
307 theFormat.end(),345 theFormat.begin(),
308 theFormat.begin(), ::toupper);346 theFormat.end(),
309 }347 theFormat.begin(), ::toupper);
310 else if (lOptionName.getLocalName() == "skip-extra-attributes")348 }
311 {349 else if (lOptionKey.getStringValue() == "skip-extra-attributes")
312 theSkipExtraAttrs = lOption.getStringValue() == "true" ? true : false;350 {
313 }351 theSkipExtraAttrs = lOptionValue.getStringValue() == "true" ? true : false;
314 }352 }
315 if (theFormat == "ZIP")353 }
316 {354 if (theFormat == "ZIP")
317 if (theCompression != "STORE" && theCompression != "DEFLATE" && theCompression != "NONE")355 {
318 {356 if (theCompression != "STORE" && theCompression != "DEFLATE" && theCompression != "NONE")
319 std::ostringstream lMsg;357 {
320 lMsg358 std::ostringstream lMsg;
321 << theCompression359 lMsg
322 << ": compression algorithm not supported for ZIP format (required: deflate, store)";360 << theCompression
323 throwError("ARCH0002", lMsg.str().c_str());361 << ": compression algorithm not supported for ZIP format (required: deflate, store)";
324 }362 throwError(ERROR_INVALID_OPTIONS, lMsg.str().c_str());
325 }363 }
326 if (theFormat == "TAR")364 }
327 {365 if (theFormat == "TAR")
328 if (theCompression != "GZIP"366 { if (theCompression != "GZIP"
329#ifndef WIN32367#ifndef WIN32
330 && theCompression != "BZIP2"368 && theCompression != "BZIP2"
331 && theCompression != "LZMA"369 && theCompression != "LZMA"
332#endif370#endif
333 )371 )
334 {372 {
335 std::ostringstream lMsg;373 std::ostringstream lMsg;
336 lMsg374 lMsg
337 << theCompression375 << theCompression
338 << ": compression algorithm not supported for TAR format (required: gzip"376 << ": compression algorithm not supported for TAR format (required: gzip"
339#ifndef WIN32377#ifndef WIN32
340 << ", bzip2, lzma"378 << ", bzip2, lzma"
341#endif379#endif
342 << ")";380 << ")";
343 throwError("ARCH0002", lMsg.str().c_str());381 throwError(ERROR_INVALID_OPTIONS, lMsg.str().c_str());
382 }
344 }383 }
345 }384 }
346 }385 }
@@ -550,7 +589,7 @@
550589
551 if (!theArchive)590 if (!theArchive)
552 ArchiveFunction::throwError(591 ArchiveFunction::throwError(
553 "ARCH9999", "internal error (couldn't create archive)");592 ERROR_CORRUPTED_ARCHIVE, "internal error (couldn't create archive)");
554593
555 setOptions(aOptions);594 setOptions(aOptions);
556 }595 }
@@ -572,7 +611,7 @@
572 std::ostringstream lMsg;611 std::ostringstream lMsg;
573 lMsg << "number of entries (" << aEntries.size()612 lMsg << "number of entries (" << aEntries.size()
574 << ") doesn't match number of content arguments (" << i << ")";613 << ") doesn't match number of content arguments (" << i << ")";
575 throwError("ARCH0001", lMsg.str().c_str());614 throwError(ERROR_ENTRY_COUNT_MISMATCH, lMsg.str().c_str());
576 }615 }
577 }616 }
578617
@@ -587,7 +626,7 @@
587 std::ostringstream lMsg;626 std::ostringstream lMsg;
588 lMsg << "number of entries (" << aEntries.size()627 lMsg << "number of entries (" << aEntries.size()
589 << ") less than number of content arguments";628 << ") less than number of content arguments";
590 throwError("ARCH0001", lMsg.str().c_str());629 throwError(ERROR_ENTRY_COUNT_MISMATCH, lMsg.str().c_str());
591 }630 }
592631
593 aFiles->close();632 aFiles->close();
@@ -601,7 +640,6 @@
601640
602 archive_entry_set_pathname(theEntry, aEntry.getEntryPath().c_str());641 archive_entry_set_pathname(theEntry, aEntry.getEntryPath().c_str());
603 archive_entry_set_mtime(theEntry, aEntry.getLastModified(), 0);642 archive_entry_set_mtime(theEntry, aEntry.getLastModified(), 0);
604 // TODO: modified to allow the creation of empty directories
605 if(aEntry.getEntryType() == ArchiveEntry::regular){643 if(aEntry.getEntryType() == ArchiveEntry::regular){
606 archive_entry_set_filetype(theEntry, AE_IFREG);644 archive_entry_set_filetype(theEntry, AE_IFREG);
607 lDeleteStream = getStream(645 lDeleteStream = getStream(
@@ -626,7 +664,7 @@
626#ifndef ZORBA_LIBARCHIVE_HAVE_SET_COMPRESSION664#ifndef ZORBA_LIBARCHIVE_HAVE_SET_COMPRESSION
627 std::ostringstream lMsg;665 std::ostringstream lMsg;
628 lMsg << lNextCompString << ": setting different compression algorithms for each entry is not supported by the used version of libarchive";666 lMsg << lNextCompString << ": setting different compression algorithms for each entry is not supported by the used version of libarchive";
629 throwError("ARCH0099", lMsg.str().c_str());667 throwError(ERROR_DIFFERENT_COMPRESSIONS_NOT_SUPPORTED, lMsg.str().c_str());
630#endif668#endif
631 }669 }
632 else670 else
@@ -638,7 +676,7 @@
638 {676 {
639 std::ostringstream lMsg;677 std::ostringstream lMsg;
640 lMsg << lNextCompString << ": compression algorithm not supported for ZIP format (required: deflate, store)";678 lMsg << lNextCompString << ": compression algorithm not supported for ZIP format (required: deflate, store)";
641 throwError("ARCH0002", lMsg.str().c_str());679 throwError(ERROR_INVALID_OPTIONS, lMsg.str().c_str());
642 }680 }
643681
644#ifdef ZORBA_LIBARCHIVE_HAVE_SET_COMPRESSION682#ifdef ZORBA_LIBARCHIVE_HAVE_SET_COMPRESSION
@@ -651,7 +689,7 @@
651 {689 {
652 std::ostringstream lMsg;690 std::ostringstream lMsg;
653 lMsg << aEntry.getCompression() << ": compression attribute only allowed for zip format";691 lMsg << aEntry.getCompression() << ": compression attribute only allowed for zip format";
654 throwError("ARCH0099", lMsg.str().c_str());692 throwError(ERROR_DIFFERENT_COMPRESSIONS_NOT_SUPPORTED, lMsg.str().c_str());
655 }693 }
656 }694 }
657695
@@ -718,7 +756,7 @@
718 {756 {
719 if (!aLocalName)757 if (!aLocalName)
720 {758 {
721 throwError("ARCH9999", archive_error_string(a));759 throwError(ERROR_CORRUPTED_ARCHIVE, archive_error_string(a));
722 }760 }
723 else761 else
724 {762 {
@@ -781,7 +819,7 @@
781 {819 {
782 std::ostringstream lMsg;820 std::ostringstream lMsg;
783 lMsg << f << ": archive format not supported";821 lMsg << f << ": archive format not supported";
784 throwError("ARCH0002", lMsg.str().c_str());822 throwError(ERROR_INVALID_OPTIONS, lMsg.str().c_str());
785 }823 }
786 return 0;824 return 0;
787 }825 }
@@ -817,7 +855,7 @@
817 {855 {
818 std::ostringstream lMsg;856 std::ostringstream lMsg;
819 lMsg << c << ": compression algorithm not supported";857 lMsg << c << ": compression algorithm not supported";
820 throwError("ARCH0002", lMsg.str().c_str());858 throwError(ERROR_INVALID_OPTIONS, lMsg.str().c_str());
821 }859 }
822 return 0;860 return 0;
823 }861 }
@@ -897,7 +935,7 @@
897935
898 if (!theArchive)936 if (!theArchive)
899 ArchiveFunction::throwError(937 ArchiveFunction::throwError(
900 "ARCH9999", "internal error (couldn't create archive)");938 ERROR_CORRUPTED_ARCHIVE, "internal error (couldn't create archive)");
901939
902 int lErr = archive_read_support_compression_all(theArchive);940 int lErr = archive_read_support_compression_all(theArchive);
903 ArchiveFunction::checkForError(lErr, 0, theArchive);941 ArchiveFunction::checkForError(lErr, 0, theArchive);
@@ -1039,15 +1077,6 @@
1039 zorba::Item& aArchive)1077 zorba::Item& aArchive)
1040 : ArchiveIterator(aArchive)1078 : ArchiveIterator(aArchive)
1041 {1079 {
1042 theUntypedQName = theFactory->createQName(
1043 "http://www.w3.org/2001/XMLSchema", "untyped");
1044
1045 theEntryName = theFactory->createQName(
1046 ArchiveModule::getModuleURI(), "entry");
1047
1048 theLastModifiedName = theFactory->createQName("", "last-modified");
1049 theUncompressedSizeName = theFactory->createQName("", "size");
1050 theEntryType = theFactory->createQName("", "type");
1051 }1080 }
10521081
1053 bool1082 bool
@@ -1064,49 +1093,42 @@
1064 ArchiveFunction::checkForError(lErr, 0, theArchive);1093 ArchiveFunction::checkForError(lErr, 0, theArchive);
1065 }1094 }
10661095
1067 Item lNoParent;1096 std::vector<std::pair<zorba::Item, zorba::Item> > lObjectArray;
10681097 std::pair<zorba::Item, zorba::Item> lElemPair;
1069 Item lType = theUntypedQName;
1070
1071 // create entry element
1072 aRes = theFactory->createElementNode(
1073 lNoParent, theEntryName, lType, true, false, NsBindings());
10741098
1075 // create text content (i.e. path name)1099 // create text content (i.e. path name)
1076 String lName = archive_entry_pathname(lEntry);1100 String lName = archive_entry_pathname(lEntry);
1077 Item lNameItem = theFactory->createString(lName);1101 lElemPair = std::make_pair<zorba::Item, zorba::Item>(ArchiveModule::getGlobalItems(ArchiveModule::NAME),
1078 theFactory->assignElementTypedValue(aRes, lNameItem);1102 theFactory->createString(lName));
1103 lObjectArray.push_back(lElemPair);
10791104
1080 // create size attr if the value is set in the archive1105 // create size attr if the value is set in the archive
1081 if (archive_entry_size_is_set(lEntry))1106 if (archive_entry_size_is_set(lEntry))
1082 {1107 {
1083 long long lSize = archive_entry_size(lEntry);1108 long long lSize = archive_entry_size(lEntry);
1084 Item lSizeItem = theFactory->createInteger(lSize);1109 lElemPair = std::make_pair<zorba::Item, zorba::Item>(ArchiveModule::getGlobalItems(ArchiveModule::SIZE),
1085 lType = theUntypedQName;1110 theFactory->createInteger(lSize));
1086 theFactory->createAttributeNode(1111 lObjectArray.push_back(lElemPair);
1087 aRes, theUncompressedSizeName, lType, lSizeItem);
1088 }1112 }
10891113
1090 // create last-modified attr if the value is set in the archive1114 // create last-modified attr if the value is set in the archive
1091 if (archive_entry_mtime_is_set(lEntry))1115 if (archive_entry_mtime_is_set(lEntry))
1092 {1116 {
1093 time_t lTime = archive_entry_mtime(lEntry);1117 time_t lTime = archive_entry_mtime(lEntry);
1094 Item lModifiedItem = ArchiveModule::createDateTimeItem(lTime);1118 lElemPair = std::make_pair<zorba::Item, zorba::Item>(ArchiveModule::getGlobalItems(ArchiveModule::LAST_MODIFIED),
10951119 ArchiveModule::createDateTimeItem(lTime));
1096 lType = theUntypedQName;1120 lObjectArray.push_back(lElemPair);
1097 theFactory->createAttributeNode(
1098 aRes, theLastModifiedName, lType, lModifiedItem);
1099 }1121 }
11001122
1101 Item lEntryType;1123 std::string lEntryType;
1102 if(archive_entry_filetype(lEntry) == AE_IFDIR)1124 if(archive_entry_filetype(lEntry) == AE_IFDIR)
1103 {1125 {
1104 // this entry is a directory1126 // this entry is a directory
1105 lEntryType = theFactory->createString("directory");1127 lEntryType = "directory";
1106 }1128 }
1107 else if(archive_entry_filetype(lEntry) == AE_IFREG)1129 else if(archive_entry_filetype(lEntry) == AE_IFREG)
1108 {1130 {
1109 lEntryType = theFactory->createString("regular");1131 lEntryType = "regular";
1110 }1132 }
1111 else1133 else
1112 {1134 {
@@ -1114,14 +1136,16 @@
1114 // for the time being don't do anything1136 // for the time being don't do anything
1115 }1137 }
11161138
1117 lType = theUntypedQName;1139 lElemPair = std::make_pair<zorba::Item, zorba::Item>(ArchiveModule::getGlobalItems(ArchiveModule::TYPE),
1118 theFactory->createAttributeNode(1140 theFactory->createString(lEntryType));
1119 aRes, theEntryType, lType, lEntryType);1141 lObjectArray.push_back(lElemPair);
11201142
1121 // skip to the next entry and raise an error if that fails1143 // skip to the next entry and raise an error if that fails
1122 lErr = archive_read_data_skip(theArchive);1144 lErr = archive_read_data_skip(theArchive);
1123 ArchiveFunction::checkForError(lErr, 0, theArchive);1145 ArchiveFunction::checkForError(lErr, 0, theArchive);
11241146
1147 aRes = theFactory->createJSONObject(lObjectArray);
1148
1125 return true;1149 return true;
1126 }1150 }
11271151
@@ -1190,7 +1214,7 @@
1190 std::ostringstream lMsg;1214 std::ostringstream lMsg;
1191 lMsg << lEncoding << ": unsupported encoding";1215 lMsg << lEncoding << ": unsupported encoding";
1192 1216
1193 throwError("ARCH0004", lMsg.str().c_str());1217 throwError(ERROR_INVALID_ENCODING, lMsg.str().c_str());
1194 }1218 }
1195 }1219 }
1196 1220
@@ -1363,6 +1387,11 @@
1363 return ItemSequence_t(new OptionsItemSequence(lArchive));1387 return ItemSequence_t(new OptionsItemSequence(lArchive));
1364 }1388 }
13651389
1390 OptionsFunction::OptionsItemSequence::OptionsIterator::OptionsIterator(Item &aArchive)
1391 :ArchiveIterator(aArchive)
1392 {
1393 }
1394
1366 bool1395 bool
1367 OptionsFunction::OptionsItemSequence::OptionsIterator::next(1396 OptionsFunction::OptionsItemSequence::OptionsIterator::next(
1368 zorba::Item& aRes)1397 zorba::Item& aRes)
@@ -1372,6 +1401,9 @@
1372 lExhausted = true;1401 lExhausted = true;
13731402
1374 struct archive_entry *lEntry;1403 struct archive_entry *lEntry;
1404 typedef std::pair<zorba::Item, zorba::Item> tArrElemt;
1405 tArrElemt lElemt;
1406 std::vector<tArrElemt> lJSONObject;
13751407
1376 // to get the format, we need to peek into the first header1408 // to get the format, we need to peek into the first header
1377 int lErr = archive_read_next_header(theArchive, &lEntry);1409 int lErr = archive_read_next_header(theArchive, &lEntry);
@@ -1391,33 +1423,15 @@
1391 lCompression = "DEFLATE";1423 lCompression = "DEFLATE";
1392 }1424 }
13931425
1394 zorba::Item lUntypedQName = theFactory->createQName(1426 lElemt = std::make_pair<zorba::Item, zorba::Item>(ArchiveModule::getGlobalItems(ArchiveModule::FORMAT),
1395 "http://www.w3.org/2001/XMLSchema", "untyped");1427 theFactory->createString(lFormat));
1396 zorba::Item lTmpQName = lUntypedQName;1428 lJSONObject.push_back(lElemt);
13971429
1398 zorba::Item lOptionsQName = theFactory->createQName(1430 lElemt = std::make_pair<zorba::Item, zorba::Item>(ArchiveModule::getGlobalItems(ArchiveModule::COMPRESSION),
1399 ArchiveModule::getModuleURI(), "options");1431 theFactory->createString(lCompression));
14001432 lJSONObject.push_back(lElemt);
1401 zorba::Item lFormatQName = theFactory->createQName(1433
1402 ArchiveModule::getModuleURI(), "format");1434 aRes = theFactory->createJSONObject(lJSONObject);
1403
1404 zorba::Item lCompressionQName = theFactory->createQName(
1405 ArchiveModule::getModuleURI(), "compression");
1406
1407 zorba::Item lNoParent;
1408 aRes = theFactory->createElementNode(
1409 lNoParent, lOptionsQName, lTmpQName, true, false, NsBindings());
1410
1411 lTmpQName = lUntypedQName;
1412 zorba::Item lFormatItem = theFactory->createElementNode(
1413 aRes, lFormatQName, lTmpQName, true, false, NsBindings());
1414
1415 lTmpQName = lUntypedQName;
1416 zorba::Item lCompressionItem = theFactory->createElementNode(
1417 aRes, lCompressionQName, lTmpQName, true, false, NsBindings());
1418
1419 theFactory->createTextNode(lFormatItem, lFormat);
1420 theFactory->createTextNode(lCompressionItem, lCompression);
14211435
1422 return true;1436 return true;
1423 }1437 }
@@ -1647,6 +1661,7 @@
1647 }1661 }
1648 // else? if the entry represents a directory what are we1662 // else? if the entry represents a directory what are we
1649 // going to return??1663 // going to return??
1664 // answer: nothing, the directory will have no contents at all
16501665
1651 return true;1666 return true;
1652 }1667 }
16531668
=== modified file 'src/archive_module.xq.src/archive_module.h'
--- src/archive_module.xq.src/archive_module.h 2013-02-18 22:00:20 +0000
+++ src/archive_module.xq.src/archive_module.h 2013-07-29 19:28:26 +0000
@@ -52,8 +52,29 @@
5252
53 FuncMap_t theFunctions;53 FuncMap_t theFunctions;
5454
55 static zorba::Item globalFormatKey;
56 static zorba::Item globalCompressionKey;
57 static zorba::Item globalNameKey;
58 static zorba::Item globalTypeKey;
59 static zorba::Item globalSizeKey;
60 static zorba::Item globalLastModifiedKey;
61 static zorba::Item globalEncodingKey;
62
55 public:63 public:
5664
65 enum GLOBAL_ITEMS { FORMAT, COMPRESSION, NAME, TYPE, SIZE, LAST_MODIFIED, ENCODING };
66
67 ArchiveModule()
68 {
69 globalFormatKey = Zorba::getInstance(0)->getItemFactory()->createString("format");
70 globalCompressionKey = Zorba::getInstance(0)->getItemFactory()->createString("compression");
71 globalNameKey = Zorba::getInstance(0)->getItemFactory()->createString("name");
72 globalTypeKey = Zorba::getInstance(0)->getItemFactory()->createString("type");
73 globalSizeKey = Zorba::getInstance(0)->getItemFactory()->createString("size");
74 globalLastModifiedKey = Zorba::getInstance(0)->getItemFactory()->createString("last-modified");
75 globalEncodingKey = Zorba::getInstance(0)->getItemFactory()->createString("encoding");
76 }
77
57 virtual ~ArchiveModule();78 virtual ~ArchiveModule();
5879
59 virtual zorba::String80 virtual zorba::String
@@ -71,7 +92,7 @@
71 }92 }
7293
73 static zorba::String94 static zorba::String
74 getModuleURI() { return "http://www.zorba-xquery.com/modules/archive"; }95 getModuleURI() { return "http://zorba.io/modules/archive"; }
7596
76 static zorba::Item97 static zorba::Item
77 createDateTimeItem(time_t&);98 createDateTimeItem(time_t&);
@@ -79,6 +100,7 @@
79 static void100 static void
80 parseDateTimeItem(const zorba::Item& i, time_t&);101 parseDateTimeItem(const zorba::Item& i, time_t&);
81102
103 static zorba::Item& getGlobalItems(enum GLOBAL_ITEMS g);
82 };104 };
83105
84106
@@ -602,8 +624,7 @@
602 class OptionsIterator : public ArchiveIterator624 class OptionsIterator : public ArchiveIterator
603 {625 {
604 public:626 public:
605 OptionsIterator(zorba::Item& aArchive)627 OptionsIterator(zorba::Item& aArchive);
606 : ArchiveIterator(aArchive) {}
607628
608 virtual ~OptionsIterator() {}629 virtual ~OptionsIterator() {}
609630
@@ -755,7 +776,6 @@
755 ArchiveOptions& theOptions;776 ArchiveOptions& theOptions;
756 };777 };
757778
758 //public:
759 DeleteItemSequence(zorba::Item& aArchive)779 DeleteItemSequence(zorba::Item& aArchive)
760 : ExtractFunction::ExtractItemSequence(aArchive, false) {}780 : ExtractFunction::ExtractItemSequence(aArchive, false) {}
761781
762782
=== modified file 'test/ExpQueryResults/entries_01.xml.res'
--- test/ExpQueryResults/entries_01.xml.res 2012-09-17 17:56:29 +0000
+++ test/ExpQueryResults/entries_01.xml.res 2013-07-29 19:28:26 +0000
@@ -1,2 +1,1 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<entry xmlns="http://www.zorba-xquery.com/modules/archive" size="0" last-modified="2012-06-15T20:11:09Z" type="directory">dir1/</entry><entry xmlns="http://www.zorba-xquery.com/modules/archive" size="11" last-modified="2012-06-15T20:11:09Z" type="regular">dir1/file1</entry><entry xmlns="http://www.zorba-xquery.com/modules/archive" size="11" last-modified="2012-06-15T20:11:03Z" type="regular">dir1/file2</entry><entry xmlns="http://www.zorba-xquery.com/modules/archive" size="0" last-modified="2012-06-15T20:10:51Z" type="directory">dir2/</entry><entry xmlns="http://www.zorba-xquery.com/modules/archive" size="6" last-modified="2012-06-15T20:10:47Z" type="regular">file1</entry>
3\ No newline at end of file1\ No newline at end of file
2{ "name" : "dir1/", "size" : 0, "last-modified" : "2012-06-15T20:11:09Z", "type" : "directory" }{ "name" : "dir1/file1", "size" : 11, "last-modified" : "2012-06-15T20:11:09Z", "type" : "regular" }{ "name" : "dir1/file2", "size" : 11, "last-modified" : "2012-06-15T20:11:03Z", "type" : "regular" }{ "name" : "dir2/", "size" : 0, "last-modified" : "2012-06-15T20:10:51Z", "type" : "directory" }{ "name" : "file1", "size" : 6, "last-modified" : "2012-06-15T20:10:47Z", "type" : "regular" }
4\ No newline at end of file3\ No newline at end of file
54
=== modified file 'test/ExpQueryResults/entries_02.xml.res'
--- test/ExpQueryResults/entries_02.xml.res 2012-09-17 17:56:29 +0000
+++ test/ExpQueryResults/entries_02.xml.res 2013-07-29 19:28:26 +0000
@@ -1,2 +1,1 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<entry xmlns="http://www.zorba-xquery.com/modules/archive" size="0" last-modified="2012-06-15T20:11:09Z" type="directory">dir1/</entry><entry xmlns="http://www.zorba-xquery.com/modules/archive" size="11" last-modified="2012-06-15T20:11:09Z" type="regular">dir1/file1</entry><entry xmlns="http://www.zorba-xquery.com/modules/archive" size="11" last-modified="2012-06-15T20:11:03Z" type="regular">dir1/file2</entry><entry xmlns="http://www.zorba-xquery.com/modules/archive" size="0" last-modified="2012-06-15T20:10:51Z" type="directory">dir2/</entry><entry xmlns="http://www.zorba-xquery.com/modules/archive" size="6" last-modified="2012-06-15T20:10:47Z" type="regular">file1</entry>
3\ No newline at end of file1\ No newline at end of file
2{ "name" : "dir1/", "size" : 0, "last-modified" : "2012-06-15T20:11:09Z", "type" : "directory" }{ "name" : "dir1/file1", "size" : 11, "last-modified" : "2012-06-15T20:11:09Z", "type" : "regular" }{ "name" : "dir1/file2", "size" : 11, "last-modified" : "2012-06-15T20:11:03Z", "type" : "regular" }{ "name" : "dir2/", "size" : 0, "last-modified" : "2012-06-15T20:10:51Z", "type" : "directory" }{ "name" : "file1", "size" : 6, "last-modified" : "2012-06-15T20:10:47Z", "type" : "regular" }
4\ No newline at end of file3\ No newline at end of file
54
=== modified file 'test/ExpQueryResults/entries_03.xml.res'
--- test/ExpQueryResults/entries_03.xml.res 2012-09-17 17:56:29 +0000
+++ test/ExpQueryResults/entries_03.xml.res 2013-07-29 19:28:26 +0000
@@ -1,1 +1,1 @@
1<entry xmlns="http://www.zorba-xquery.com/modules/archive" size="0" last-modified="2012-06-15T20:11:09Z" type="directory">dir1/</entry><entry xmlns="http://www.zorba-xquery.com/modules/archive" size="11" last-modified="2012-06-15T20:11:09Z" type="regular">dir1/file1</entry><entry xmlns="http://www.zorba-xquery.com/modules/archive" size="11" last-modified="2012-06-15T20:11:03Z" type="regular">dir1/file2</entry><entry xmlns="http://www.zorba-xquery.com/modules/archive" size="0" last-modified="2012-06-15T20:10:51Z" type="directory">dir2/</entry><entry xmlns="http://www.zorba-xquery.com/modules/archive" size="6" last-modified="2012-06-15T20:10:47Z" type="regular">file1</entry>1{ "name" : "dir1/", "size" : 0, "last-modified" : "2012-06-15T20:11:09Z", "type" : "directory" }{ "name" : "dir1/file1", "size" : 11, "last-modified" : "2012-06-15T20:11:09Z", "type" : "regular" }{ "name" : "dir1/file2", "size" : 11, "last-modified" : "2012-06-15T20:11:03Z", "type" : "regular" }{ "name" : "dir2/", "size" : 0, "last-modified" : "2012-06-15T20:10:51Z", "type" : "directory" }{ "name" : "file1", "size" : 6, "last-modified" : "2012-06-15T20:10:47Z", "type" : "regular" }
2\ No newline at end of file2\ No newline at end of file
33
=== modified file 'test/ExpQueryResults/options_01.xml.res'
--- test/ExpQueryResults/options_01.xml.res 2012-08-03 21:54:38 +0000
+++ test/ExpQueryResults/options_01.xml.res 2013-07-29 19:28:26 +0000
@@ -1,2 +1,1 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<options xmlns="http://www.zorba-xquery.com/modules/archive"><format>ZIP</format><compression>DEFLATE</compression></options><options xmlns="http://www.zorba-xquery.com/modules/archive"><format>TAR</format><compression>GZIP</compression></options>
3\ No newline at end of file1\ No newline at end of file
2{ "format" : "ZIP", "compression" : "DEFLATE" }{ "format" : "TAR", "compression" : "GZIP" }
4\ No newline at end of file3\ No newline at end of file
54
=== modified file 'test/ExpQueryResults/options_02.xml.res'
--- test/ExpQueryResults/options_02.xml.res 2012-09-17 18:17:09 +0000
+++ test/ExpQueryResults/options_02.xml.res 2013-07-29 19:28:26 +0000
@@ -1,2 +1,1 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<options xmlns="http://www.zorba-xquery.com/modules/archive"><format>TAR</format><compression>BZIP2</compression></options>
3\ No newline at end of file1\ No newline at end of file
2{ "format" : "TAR", "compression" : "BZIP2" }
4\ No newline at end of file3\ No newline at end of file
54
=== modified file 'test/Queries/create_01.xq'
--- test/Queries/create_01.xq 2012-07-27 03:43:13 +0000
+++ test/Queries/create_01.xq 2013-07-29 19:28:26 +0000
@@ -1,4 +1,4 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
22
3let $foo-content := "<foo/>"3let $foo-content := "<foo/>"
4let $bar-content := "<bar/>"4let $bar-content := "<bar/>"
@@ -8,6 +8,7 @@
8)8)
9return9return
10 string-join(10 string-join(
11 for $a in a:entries($archive)11 for $name in a:entries($archive)("name")
12 return a:extract-text($archive, $a/text())12 return a:extract-text($archive, $name)
13 ) eq concat($foo-content, $bar-content)13 ) eq concat($foo-content, $bar-content)
14
1415
=== modified file 'test/Queries/create_02.xq'
--- test/Queries/create_02.xq 2013-07-17 07:50:04 +0000
+++ test/Queries/create_02.xq 2013-07-29 19:28:26 +0000
@@ -1,10 +1,10 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
2import module namespace b = "http://zorba.io/modules/base64";2import module namespace b = "http://zorba.io/modules/base64";
33
4let $foo-content := "<foo/>"4let $foo-content := "<foo/>"
5let $bar-content := xs:base64Binary("5Pb8")5let $bar-content := xs:base64Binary("5Pb8")
6let $archive := a:create(6let $archive := a:create(
7 ("foo.xml", <a:entry encoding="ISO-8859-1">bar.xml</a:entry>),7 ("foo.xml", { "encoding" : "ISO-8859-1", "name" : "bar.xml" }),
8 ($foo-content, $bar-content)8 ($foo-content, $bar-content)
9)9)
10return10return
1111
=== modified file 'test/Queries/create_03.spec'
--- test/Queries/create_03.spec 2012-07-27 03:43:13 +0000
+++ test/Queries/create_03.spec 2013-07-29 19:28:26 +0000
@@ -1,1 +1,1 @@
1Error: http://www.zorba-xquery.com/modules/archive:ARCH00991Error: http://zorba.io/modules/archive:DIFFERENT-COMPRESSIONS-NOT-SUPPORTED
22
=== modified file 'test/Queries/create_03.xq'
--- test/Queries/create_03.xq 2012-07-27 03:43:13 +0000
+++ test/Queries/create_03.xq 2013-07-29 19:28:26 +0000
@@ -1,9 +1,10 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
22
3let $foo-content := "<foo/>"3let $foo-content := "<foo/>"
4let $bar-content := "<bar/>"4let $bar-content := "<bar/>"
5let $archive := a:create(5let $archive := a:create(
6 (<a:entry compression="store">foo.xml</a:entry>, <a:entry compression="deflate">bar.xml</a:entry>),6 ({ "compression" : "store", "name" : "foo.xml" },
7 { "compression" : "deflate", "name" : "bar.xml" }),
7 ($foo-content, $bar-content)8 ($foo-content, $bar-content)
8)9)
9return10return
1011
=== modified file 'test/Queries/delete_01.xq'
--- test/Queries/delete_01.xq 2013-07-17 07:50:04 +0000
+++ test/Queries/delete_01.xq 2013-07-29 19:28:26 +0000
@@ -1,4 +1,4 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
2import module namespace b = "http://zorba.io/modules/base64";2import module namespace b = "http://zorba.io/modules/base64";
33
4let $foo-content := "<foo/>"4let $foo-content := "<foo/>"
55
=== modified file 'test/Queries/delete_02.xq'
--- test/Queries/delete_02.xq 2012-07-27 03:43:13 +0000
+++ test/Queries/delete_02.xq 2013-07-29 19:28:26 +0000
@@ -1,5 +1,4 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
2import schema namespace as = "http://www.zorba-xquery.com/modules/archive";
3import module namespace f = "http://expath.org/ns/file";2import module namespace f = "http://expath.org/ns/file";
43
5let $a := f:read-binary(resolve-uri("linear-algebra-20120306.epub"))4let $a := f:read-binary(resolve-uri("linear-algebra-20120306.epub"))
65
=== modified file 'test/Queries/delete_03.xq'
--- test/Queries/delete_03.xq 2012-07-27 03:43:13 +0000
+++ test/Queries/delete_03.xq 2013-07-29 19:28:26 +0000
@@ -1,12 +1,12 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
22
3let $foo-content := "<foo/>"3let $foo-content := "<foo/>"
4let $bar-content := xs:base64Binary("YWJj")4let $bar-content := xs:base64Binary("YWJj")
5let $options := 5let $options :=
6<a:options>6{
7 <a:format>TAR</a:format>7 "format" : "TAR",
8 <a:compression>GZIP</a:compression>8 "compression" : "GZIP"
9</a:options>9}
10let $archive0 := a:create(10let $archive0 := a:create(
11 ("foo.xml"),11 ("foo.xml"),
12 ($foo-content),12 ($foo-content),
1313
=== modified file 'test/Queries/delete_04.xq'
--- test/Queries/delete_04.xq 2012-07-27 03:43:13 +0000
+++ test/Queries/delete_04.xq 2013-07-29 19:28:26 +0000
@@ -1,13 +1,13 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
22
3let $foo-content := "<foo/>"3let $foo-content := "<foo/>"
4let $bar-content := xs:base64Binary("YWJj")4let $bar-content := xs:base64Binary("YWJj")
5let $foo2-content := "<foo2/>"5let $foo2-content := "<foo2/>"
6let $options := 6let $options :=
7<a:options>7{
8 <a:format>TAR</a:format>8 "format" : "TAR",
9 <a:compression>GZIP</a:compression>9 "compression" : "GZIP"
10</a:options>10}
11let $archive0 := a:create(11let $archive0 := a:create(
12 ("foo.xml"),12 ("foo.xml"),
13 ($foo-content),13 ($foo-content),
1414
=== modified file 'test/Queries/dir_01.xq'
--- test/Queries/dir_01.xq 2012-09-06 20:40:47 +0000
+++ test/Queries/dir_01.xq 2013-07-29 19:28:26 +0000
@@ -1,10 +1,10 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
22
3let $foo-content := "<foo/>"3let $foo-content := "<foo/>"
4let $bar-content := "<bar/>"4let $bar-content := "<bar/>"
5let $archive := a:create(5let $archive := a:create(
6 ("foo.xml", "bar.xml", <entry type="directory">dir1</entry>),6 ("foo.xml", "bar.xml", { "type" : "directory", "name" : "dir1" }),
7 ($foo-content, $bar-content)7 ($foo-content, $bar-content)
8)8)
9return9return
10 for $e in a:entries($archive) return concat($e/text(), ",")10 for $e in a:entries($archive)("name") return concat($e, ",")
1111
=== modified file 'test/Queries/dir_02.xq'
--- test/Queries/dir_02.xq 2012-09-06 20:40:47 +0000
+++ test/Queries/dir_02.xq 2013-07-29 19:28:26 +0000
@@ -1,11 +1,11 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
22
3let $foo-content := "<foo/>"3let $foo-content := "<foo/>"
4let $bar-content := "<bar/>"4let $bar-content := "<bar/>"
5let $archive := a:create(5let $archive := a:create(
6 ("foo.xml", "bar.xml", <entry type="directory">dir1</entry>),6 ("foo.xml", "bar.xml", { "type" : "directory", "name" : "dir1" }),
7 ($foo-content, $bar-content)7 ($foo-content, $bar-content)
8)8)
9let $archive2 := a:delete($archive, "dir1/")9let $archive2 := a:delete($archive, "dir1/")
10return10return
11 for $e in a:entries($archive2) return concat($e/text(), ",")11 for $e in a:entries($archive2)("name") return concat($e, ",")
1212
=== modified file 'test/Queries/dir_03.xq'
--- test/Queries/dir_03.xq 2012-09-06 20:40:47 +0000
+++ test/Queries/dir_03.xq 2013-07-29 19:28:26 +0000
@@ -1,13 +1,13 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
22
3let $foo-content := "<foo/>"3let $foo-content := "<foo/>"
4let $bar-content := "<bar/>"4let $bar-content := "<bar/>"
5let $archive := a:create(5let $archive := a:create(
6 ("foo.xml", "bar.xml", <entry type="directory">dir1</entry>),6 ("foo.xml", "bar.xml", { "type" : "directory", "name" : "dir1" }),
7 ($foo-content, $bar-content)7 ($foo-content, $bar-content)
8)8)
9let $archive2 := a:delete($archive, "nonexistent.xml")9let $archive2 := a:delete($archive, "nonexistent.xml")
10let $entries := a:entries($archive)10let $entries := a:entries($archive)
11let $entries2 := a:entries($archive2)11let $entries2 := a:entries($archive2)
12return $entries=$entries212return count($entries)=count($entries2)
13 13
1414
=== modified file 'test/Queries/dir_04.xq'
--- test/Queries/dir_04.xq 2012-09-06 20:40:47 +0000
+++ test/Queries/dir_04.xq 2013-07-29 19:28:26 +0000
@@ -1,13 +1,13 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
22
3let $foo-content := "<foo/>"3let $foo-content := "<foo/>"
4let $bar-content := "<bar/>"4let $bar-content := "<bar/>"
5let $archive := a:create(5let $archive := a:create(
6 ("foo.xml", "bar.xml", <entry type="directory">dir1</entry>),6 ("foo.xml", "bar.xml", { "type" : "directory", "name" : "dir1" }),
7 ($foo-content, $bar-content)7 ($foo-content, $bar-content)
8)8)
9let $archive2 := a:update($archive, <a:entry type="directory">newdir</a:entry>, ())9let $archive2 := a:update($archive, { "type" : "directory", "name" : "newdir" }, ())
10let $entries := a:entries($archive)10let $entries := a:entries($archive)
11let $entries2 := a:entries($archive2)11let $entries2 := a:entries($archive2)
12return for $e in $entries2 return concat($e/text(), ",")12return for $e in $entries2("name") return concat($e, ",")
13 13
1414
=== modified file 'test/Queries/entries_01.xq'
--- test/Queries/entries_01.xq 2012-07-27 03:43:13 +0000
+++ test/Queries/entries_01.xq 2013-07-29 19:28:26 +0000
@@ -1,6 +1,7 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
2import schema namespace as = "http://www.zorba-xquery.com/modules/archive";2(: import schema namespace as = "http://zorba.io/modules/archive"; :)
3import module namespace f = "http://expath.org/ns/file";3import module namespace f = "http://expath.org/ns/file";
44
5for $a in a:entries(f:read-binary(resolve-uri("simple.zip")))5for $a in a:entries(f:read-binary(resolve-uri("simple.zip")))
6return validate { $a }6(: return validate { $a } :)
7return $a
78
=== modified file 'test/Queries/entries_02.xq'
--- test/Queries/entries_02.xq 2012-07-27 03:43:13 +0000
+++ test/Queries/entries_02.xq 2013-07-29 19:28:26 +0000
@@ -1,7 +1,6 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
2import schema namespace as = "http://www.zorba-xquery.com/modules/archive";
3import module namespace f = "http://expath.org/ns/file";2import module namespace f = "http://expath.org/ns/file";
43
5for $a in a:entries(f:read-binary(resolve-uri("simple.tar.gz")))4for $a in a:entries(f:read-binary(resolve-uri("simple.tar.gz")))
6return validate { $a }5return $a
76
87
=== modified file 'test/Queries/entries_03.spec'
--- test/Queries/entries_03.spec 2012-09-06 20:40:47 +0000
+++ test/Queries/entries_03.spec 2013-07-29 19:28:26 +0000
@@ -1,1 +1,1 @@
1Error: http://www.zorba-xquery.com/modules/archive:ARCH99991Error: http://zorba.io/modules/archive:CORRUPTED-ARCHIVE
22
=== modified file 'test/Queries/entries_03.xq'
--- test/Queries/entries_03.xq 2012-07-27 03:43:13 +0000
+++ test/Queries/entries_03.xq 2013-07-29 19:28:26 +0000
@@ -1,7 +1,8 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
2import schema namespace as = "http://www.zorba-xquery.com/modules/archive";2(: import schema namespace as = "http://zorba.io/modules/archive"; :)
3import module namespace f = "http://expath.org/ns/file";3import module namespace f = "http://expath.org/ns/file";
44
5for $a in a:entries(f:read-binary(resolve-uri("simple.tar.bz2")))5for $a in a:entries(f:read-binary(resolve-uri("simple.tar.bz2")))
6return validate { $a }6(: return validate { $a } :)
7return $a
78
89
=== modified file 'test/Queries/entries_04.spec'
--- test/Queries/entries_04.spec 2012-07-27 03:43:13 +0000
+++ test/Queries/entries_04.spec 2013-07-29 19:28:26 +0000
@@ -1,1 +1,1 @@
1Error: http://www.zorba-xquery.com/modules/archive:ARCH99991Error: http://zorba.io/modules/archive:CORRUPTED-ARCHIVE
22
=== modified file 'test/Queries/entries_04.xq'
--- test/Queries/entries_04.xq 2012-07-27 03:43:13 +0000
+++ test/Queries/entries_04.xq 2013-07-29 19:28:26 +0000
@@ -1,7 +1,8 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
2import schema namespace as = "http://www.zorba-xquery.com/modules/archive";2(: import schema namespace as = "http://zorba.io/modules/archive"; :)
3import module namespace f = "http://expath.org/ns/file";3import module namespace f = "http://expath.org/ns/file";
44
5for $a in a:entries(f:read-binary(resolve-uri("invalid.zip")))5for $a in a:entries(f:read-binary(resolve-uri("invalid.zip")))
6return validate { $a }6(: return validate { $a } :)
7return $a
78
89
=== modified file 'test/Queries/extract_01.xq'
--- test/Queries/extract_01.xq 2012-07-27 03:43:13 +0000
+++ test/Queries/extract_01.xq 2013-07-29 19:28:26 +0000
@@ -1,5 +1,4 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
2import schema namespace as = "http://www.zorba-xquery.com/modules/archive";
3import module namespace f = "http://expath.org/ns/file";2import module namespace f = "http://expath.org/ns/file";
43
5for $a in a:extract-text(f:read-binary(resolve-uri("simple.zip")))4for $a in a:extract-text(f:read-binary(resolve-uri("simple.zip")))
65
=== modified file 'test/Queries/extract_02.xq'
--- test/Queries/extract_02.xq 2012-07-27 03:43:13 +0000
+++ test/Queries/extract_02.xq 2013-07-29 19:28:26 +0000
@@ -1,4 +1,4 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
2import module namespace f = "http://expath.org/ns/file";2import module namespace f = "http://expath.org/ns/file";
33
4 for $a in a:extract-text(f:read-binary(fn:resolve-uri("simple.zip")), "dir1/file1")4 for $a in a:extract-text(f:read-binary(fn:resolve-uri("simple.zip")), "dir1/file1")
55
=== modified file 'test/Queries/extract_03.spec'
--- test/Queries/extract_03.spec 2012-07-27 03:43:13 +0000
+++ test/Queries/extract_03.spec 2013-07-29 19:28:26 +0000
@@ -1,1 +1,1 @@
1Error: http://www.zorba-xquery.com/modules/archive:ARCH00041Error: http://zorba.io/modules/archive:INVALID-ENCODING
22
=== modified file 'test/Queries/extract_03.xq'
--- test/Queries/extract_03.xq 2012-07-27 03:43:13 +0000
+++ test/Queries/extract_03.xq 2013-07-29 19:28:26 +0000
@@ -1,4 +1,4 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
2import module namespace f = "http://expath.org/ns/file";2import module namespace f = "http://expath.org/ns/file";
33
4 for $a in a:extract-text(f:read-binary(fn:resolve-uri("simple.zip")), "dir1/file1", "foo")4 for $a in a:extract-text(f:read-binary(fn:resolve-uri("simple.zip")), "dir1/file1", "foo")
55
=== modified file 'test/Queries/extract_04.xq'
--- test/Queries/extract_04.xq 2012-07-27 03:43:13 +0000
+++ test/Queries/extract_04.xq 2013-07-29 19:28:26 +0000
@@ -1,4 +1,4 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
2import module namespace f = "http://expath.org/ns/file";2import module namespace f = "http://expath.org/ns/file";
33
4for $a in a:extract-text(f:read-binary(fn:resolve-uri("transcoding.zip")), "dir2/iso-8859-1.txt", "ISO-8859-1")4for $a in a:extract-text(f:read-binary(fn:resolve-uri("transcoding.zip")), "dir2/iso-8859-1.txt", "ISO-8859-1")
55
=== modified file 'test/Queries/extract_05.xq'
--- test/Queries/extract_05.xq 2012-07-27 03:43:13 +0000
+++ test/Queries/extract_05.xq 2013-07-29 19:28:26 +0000
@@ -1,7 +1,7 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
2import module namespace f = "http://expath.org/ns/file";2import module namespace f = "http://expath.org/ns/file";
33
4let $f := f:read-binary(resolve-uri("linear-algebra-20120306.epub"))4let $f := f:read-binary(resolve-uri("linear-algebra-20120306.epub"))
5for $a in a:entries($f)5for $a in a:entries($f)("name")
6where $a/text() eq "EPUB/xhtml/fcla-xml-2.30li91.html"6where $a eq "EPUB/xhtml/fcla-xml-2.30li91.html"
7return a:extract-text($f, $a/text())7return a:extract-text($f, $a)
88
=== modified file 'test/Queries/extract_06.xq'
--- test/Queries/extract_06.xq 2012-07-27 03:43:13 +0000
+++ test/Queries/extract_06.xq 2013-07-29 19:28:26 +0000
@@ -1,4 +1,4 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
2import module namespace f = "http://expath.org/ns/file";2import module namespace f = "http://expath.org/ns/file";
33
4 for $a in a:extract-binary(f:read-binary(fn:resolve-uri("simple.zip")), "dir1/file1")4 for $a in a:extract-binary(f:read-binary(fn:resolve-uri("simple.zip")), "dir1/file1")
55
=== modified file 'test/Queries/extract_07.xq'
--- test/Queries/extract_07.xq 2012-07-27 03:43:13 +0000
+++ test/Queries/extract_07.xq 2013-07-29 19:28:26 +0000
@@ -1,6 +1,6 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
2import module namespace f = "http://expath.org/ns/file";2import module namespace f = "http://expath.org/ns/file";
33
4let $f := f:read-binary(fn:resolve-uri("linear-algebra-20120306.epub"))4let $f := f:read-binary(fn:resolve-uri("linear-algebra-20120306.epub"))
5for $a in a:entries($f)[position() > 2 and position() < 5]5for $a in a:entries($f)("name")[position() > 2 and position() < 5]
6return <text>{a:extract-binary($f, $a)}</text>6return <text>{a:extract-binary($f, $a)}</text>
77
=== modified file 'test/Queries/options_01.xq'
--- test/Queries/options_01.xq 2012-08-03 21:54:38 +0000
+++ test/Queries/options_01.xq 2013-07-29 19:28:26 +0000
@@ -1,4 +1,4 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
2import module namespace f = "http://expath.org/ns/file";2import module namespace f = "http://expath.org/ns/file";
33
4let $zip := f:read-binary(fn:resolve-uri("linear-algebra-20120306.epub"))4let $zip := f:read-binary(fn:resolve-uri("linear-algebra-20120306.epub"))
55
=== modified file 'test/Queries/options_02.spec'
--- test/Queries/options_02.spec 2012-09-06 20:40:47 +0000
+++ test/Queries/options_02.spec 2013-07-29 19:28:26 +0000
@@ -1,1 +1,1 @@
1Error: http://www.zorba-xquery.com/modules/archive:ARCH99991Error: http://zorba.io/modules/archive:CORRUPTED-ARCHIVE
22
=== modified file 'test/Queries/options_02.xq'
--- test/Queries/options_02.xq 2012-09-06 20:40:47 +0000
+++ test/Queries/options_02.xq 2013-07-29 19:28:26 +0000
@@ -1,4 +1,4 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
2import module namespace f = "http://expath.org/ns/file";2import module namespace f = "http://expath.org/ns/file";
33
4let $tar-bz2 := f:read-binary(fn:resolve-uri("simple.tar.bz2"))4let $tar-bz2 := f:read-binary(fn:resolve-uri("simple.tar.bz2"))
55
=== modified file 'test/Queries/options_03.spec'
--- test/Queries/options_03.spec 2012-09-06 20:40:47 +0000
+++ test/Queries/options_03.spec 2013-07-29 19:28:26 +0000
@@ -1,1 +1,1 @@
1Error: http://www.zorba-xquery.com/modules/archive:ARCH99991Error: http://zorba.io/modules/archive:CORRUPTED-ARCHIVE
22
=== modified file 'test/Queries/options_03.xq'
--- test/Queries/options_03.xq 2012-09-06 20:40:47 +0000
+++ test/Queries/options_03.xq 2013-07-29 19:28:26 +0000
@@ -1,4 +1,4 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
22
3let $fake_archive := xs:base64Binary("5Pb8")3let $fake_archive := xs:base64Binary("5Pb8")
4return 4return
55
=== modified file 'test/Queries/update_01.xq'
--- test/Queries/update_01.xq 2013-07-17 07:50:04 +0000
+++ test/Queries/update_01.xq 2013-07-29 19:28:26 +0000
@@ -1,4 +1,4 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
2import module namespace b = "http://zorba.io/modules/base64";2import module namespace b = "http://zorba.io/modules/base64";
33
4let $foo-content := "<foo/>"4let $foo-content := "<foo/>"
55
=== modified file 'test/Queries/update_02.xq'
--- test/Queries/update_02.xq 2013-07-17 07:50:04 +0000
+++ test/Queries/update_02.xq 2013-07-29 19:28:26 +0000
@@ -1,4 +1,4 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
2import module namespace b = "http://zorba.io/modules/base64";2import module namespace b = "http://zorba.io/modules/base64";
33
4let $foo-content := "<foo/>"4let $foo-content := "<foo/>"
55
=== modified file 'test/Queries/update_03.spec'
--- test/Queries/update_03.spec 2012-09-06 20:40:47 +0000
+++ test/Queries/update_03.spec 2013-07-29 19:28:26 +0000
@@ -1,1 +1,1 @@
1Error: http://www.zorba-xquery.com/modules/archive:ARCH00011Error: http://zorba.io/modules/archive:ENTRY-COUNT
22
=== modified file 'test/Queries/update_03.xq'
--- test/Queries/update_03.xq 2013-07-17 07:50:04 +0000
+++ test/Queries/update_03.xq 2013-07-29 19:28:26 +0000
@@ -1,4 +1,4 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
2import module namespace b = "http://zorba.io/modules/base64";2import module namespace b = "http://zorba.io/modules/base64";
33
4let $foo-content := "<foo/>"4let $foo-content := "<foo/>"
55
=== modified file 'test/Queries/update_04.spec'
--- test/Queries/update_04.spec 2012-09-06 20:40:47 +0000
+++ test/Queries/update_04.spec 2013-07-29 19:28:26 +0000
@@ -1,1 +1,1 @@
1Error: http://www.zorba-xquery.com/modules/archive:ARCH99991Error: http://zorba.io/modules/archive:CORRUPTED-ARCHIVE
22
=== modified file 'test/Queries/update_04.xq'
--- test/Queries/update_04.xq 2013-07-17 07:50:04 +0000
+++ test/Queries/update_04.xq 2013-07-29 19:28:26 +0000
@@ -1,4 +1,4 @@
1import module namespace a = "http://www.zorba-xquery.com/modules/archive";1import module namespace a = "http://zorba.io/modules/archive";
2import module namespace b = "http://zorba.io/modules/base64";2import module namespace b = "http://zorba.io/modules/base64";
33
4let $fake_archive := xs:base64Binary("YWJj")4let $fake_archive := xs:base64Binary("YWJj")

Subscribers

People subscribed via source and target branches

to all changes: