Merge lp:~zorba-coders/zorba/data-converters-module-doc into lp:~zorba-coders/zorba/data-converters-module

Proposed by William Candillon
Status: Merged
Merged at revision: 84
Proposed branch: lp:~zorba-coders/zorba/data-converters-module-doc
Merge into: lp:~zorba-coders/zorba/data-converters-module
Diff against target: 241 lines (+76/-90)
2 files modified
src/com/zorba-xquery/www/modules/converters/csv.xq (+75/-89)
src/com/zorba-xquery/www/modules/converters/html.xq (+1/-1)
To merge this branch: bzr merge lp:~zorba-coders/zorba/data-converters-module-doc
Reviewer Review Type Date Requested Status
William Candillon Approve
Sorin Marian Nasoi Approve
Review via email: mp+126951@code.launchpad.net

Commit message

Minor documentation improvements.

Description of the change

Minor documentation improvements.

To post a comment you must log in.
Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) wrote :

Please note that these changes work only in the new XQDoc generator that is not yet merged into the trunk.

review: Approve
Revision history for this message
William Candillon (wcandillon) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/com/zorba-xquery/www/modules/converters/csv.xq'
2--- src/com/zorba-xquery/www/modules/converters/csv.xq 2011-08-17 23:28:43 +0000
3+++ src/com/zorba-xquery/www/modules/converters/csv.xq 2012-09-28 12:53:22 +0000
4@@ -21,7 +21,7 @@
5 : The functions are optimized to work with large amounts of data, in a streaming way.
6 :
7 : @author Daniel Turcanu
8- : @project data processing/data converters
9+ : @project Zorba/Data Converters/CSV
10 :)
11 module namespace csv = "http://www.zorba-xquery.com/modules/converters/csv";
12
13@@ -40,32 +40,24 @@
14
15 (:~
16 : Parse a CSV or fixed size text and convert to XML.<br/>
17- : By default each line is converted to a &lt;row> element, and each field to a &lt;column> element inside &lt;row>.<br/>
18+ : By default each line is converted to a <code>row</code> element, and each field to a <code>column</code> element inside <code>row</code>.<br/>
19 : The format of the param $options is:<br/>
20- : &lt;csv-options:options><br/>
21- : &lt;csv [separator="default comma ,"] ? <br/>
22- : [quote-char="default double quotes &amp;quote;"]? <br/>
23- : [quote-escape="default double double quotes &amp;quote;&amp;quote;"]? /> <br/>
24- : <br/>
25- : or<br/>
26- : &lt;column-widths><br/>
27- : &lt;column-width><i>[column fixed width, unsigned int]</i>&lt;column-width>*<br/>
28- : &lt;/column-widths><br/>
29- : <br/>
30- : or<br/>
31- : &lt;column-positions><br/>
32- : &lt;column-position><i>[column position on line, unsigned int]</i>&lt;column-position>*<br/>
33- : &lt;/column-positions><br/>
34- : <br/>
35- : &lt;first-row-is-header [line="<i>first_line[-last_line]?</i>"]?/>?<br/>
36- : &lt;start-from-row line="<i>first_line[-last_line]?</i>"/>?<br/>
37- : &lt;add-last-void-columns/>?<br/>
38- : &lt;xml-nodes><br/>
39- : [&lt;<i>row-name</i>><br/>
40- : [&lt;<i>column-name/</i>>]?<br/>
41- : &lt;/<i>row-name</i>>]?<br/>
42- : &lt;/xml-nodes>?<br/>
43- : &lt;/csv-options:options><br/>
44+ : <pre class="ace-static" ace-mode="xquery"><![CDATA[<csv-options:options>
45+ : <csv [separator="default comma ,"]?
46+ : [quote-char="default double quotes &quote;"]?
47+ : [quote-escape="default double double quotes &quote;&quote;"]? />
48+ : <column-widths>
49+ : <column-width>[(column fixed width | column fixed width), unsigned int]<column-width>*
50+ : </column-widths>
51+ : <first-row-is-header [line="<i>first_line[-last_line]?</i>"]?/>?
52+ : <start-from-row line="<i>first_line[-last_line]?</i>"/>?
53+ : <add-last-void-columns/>?
54+ : <xml-nodes>
55+ : [<row-name>
56+ : [<column-name/>]?
57+ : <row-name />]?
58+ : </xml-nodes>?
59+ : </csv-options:options>]]></pre>
60 : <br/>
61 : All the parameters are optional and can appear in any order.<br/>
62 : All the parameters are case sensitive. The namespace used is "http://www.zorba-xquery.com/modules/converters/csv-options".<br/>
63@@ -113,11 +105,11 @@
64 : 1,John,student</i><br/>
65 : <br/>
66 : is parsed into<br/>
67- : <i>&lt;row><br/>
68- : &lt;ID>1&lt;/ID><br/>
69- : &lt;Name>John&lt;/Name><br/>
70- : &lt;Occupation>student&lt;/Occupation><br/>
71- : &lt;/row></i><br/>
72+ : <pre class="ace-static" ace-mode="xquery"><![CDATA[<row>
73+ : <ID>1</ID>
74+ : <Name>John</Name>
75+ : <Occupation>student</Occupation>
76+ : </row>]]></pre>
77 : <br/>
78 : If the header names contain characters that cannot be used in a QName, they are replaced with underscore '_'.<br/>
79 : The namespace for the header QNames is taken from the column name specified in xml-nodes parameter, or from
80@@ -134,14 +126,14 @@
81 : 1,John,Howard,student</i><br/>
82 : <br/>
83 : is parsed into<br/>
84- : <i>&lt;row><br/>
85- : &lt;ID>1&lt;/ID><br/>
86- : &lt;Name><br/>
87- : &lt;First_Name>John&lt;/First_Name><br/>
88- : &lt;Last_Name>Howard&lt;/Last_Name><br/>
89- : &lt;/Name><br/>
90- : &lt;Occupation>student&lt;/Occupation><br/>
91- : &lt;/row></i><br/>
92+ : <pre class="ace-static" ace-mode="xquery"><![CDATA[<row>
93+ : <ID>1</ID>
94+ : <Name>
95+ : <First_Name>John</First_Name>
96+ : <Last_Name>Howard</Last_Name>
97+ : </Name>
98+ : <Occupation>student</Occupation>
99+ : </row>]]></pre>
100 : <br/>
101 : This element can have an attribute "accept-all-lines" with values "false" or "true" (default "false").
102 : When set to true it tells the parser to not report lines that do not have the same number of items as
103@@ -165,18 +157,18 @@
104 : that enclose the fields in the output xml if there is no header. <br/>
105 : If the csv has a header, only the namespace is used from the column element.<br/>
106 : For example, with parameter:<br/>
107- : <i>&lt;xml-nodes><br/>
108- : &lt;r><br/>
109- : &lt;c/><br/>
110- : &lt;/r><br/>
111- : &lt;/xml-nodes></i><br/>
112+ : <pre class="ace-static" ace-mode="xquery"><![CDATA[<xml-nodes>
113+ : <r>
114+ : <c />
115+ : </r>
116+ : </xml-nodes>]]></pre>
117 : <br/>
118 : the output for each line will look like<br/>
119- : <i>&lt;r><br/>
120- : &lt;c>field1&lt;/c><br/>
121- : &lt;c>field2&lt;/c><br/>
122- : .......<br/>
123- : &lt;/r></i><br/>
124+ : <pre class="ace-static" ace-mode="xquery"><![CDATA[<r>
125+ : <c>field1</c>
126+ : <c>field2</c>
127+ : ......
128+ : </r>]]></pre>
129 : </dd>
130 : </dl>
131 : @param $csv the string containing the csv or fixed size text.
132@@ -220,34 +212,29 @@
133 :
134 : Note: if you want to serialize out the result, make sure that the serializer method is set to "text".
135 : For example, in zorba command line, you have to set the param --serialize-text.
136- : When using the <pre>file:write(...)</pre> function, you have to set the
137+ : When using the <code>file:write(...)</code> function, you have to set the
138 : method serialization parameter to "text":
139- : <pre>
140- : &lt;output:serialization-parameters&lt;
141- : &lt;output:method value="text"/&lt;
142- : &lt;/output:serialization-parameters&lt;
143- : </pre>
144+ : <pre class="ace-static" ace-mode="xquery"><![CDATA[<output:serialization-parameters>
145+ : <output:method value="text"/>
146+ : </output:serialization-parameters>]]></pre>
147 :
148- : The <pre>$options</pre> parameter must have the following format:
149- : <pre>
150- : &lt;csv-options:options><br/>
151- : &lt;csv [separator="default comma ,"] ? <br/>
152- : [quote-char="default double quotes &amp;quote;"]? <br/>
153- : [quote-escape="default double double quotes &amp;quote;&amp;quote;"]? /> <br/>
154- : <br/>
155- : or<br/>
156- : &lt;column-widths [align="left|right"]?><br/>
157- : &lt;column-width [align="left|right"]?><i>[column fixed width, unsigned int]</i>&lt;column-width>*<br/>
158- : &lt;/column-widths><br/>
159- : <br/>
160- : or<br/>
161- : &lt;column-positions [align="left|right"]?><br/>
162- : &lt;column-position [align="left|right"]?><i>[column position on line, unsigned int]</i>&lt;column-position>*<br/>
163- : &lt;/column-positions><br/>
164- : <br/>
165- : &lt;first-row-is-header/>?<br/>
166- : &lt;/csv-options:options>
167- : </pre>
168+ : The <code>$options</code> parameter must have the following format:
169+ : <pre class="ace-static" ace-mode="xquery"><![CDATA[<csv-options:options>
170+ : <csv [separator="default comma ,"]?
171+ : [quote-char="default double quotes &quote;"]?
172+ : [quote-escape="default double double quotes &quote;&quote;"]? />
173+ : <column-widths>
174+ : <column-width>[(column fixed width | column fixed width), unsigned int]<column-width>*
175+ : </column-widths>
176+ : <first-row-is-header [line="<i>first_line[-last_line]?</i>"]?/>?
177+ : <start-from-row line="<i>first_line[-last_line]?</i>"/>?
178+ : <add-last-void-columns/>?
179+ : <xml-nodes>
180+ : [<row-name>
181+ : [<column-name/>]?
182+ : <row-name />]?
183+ : </xml-nodes>?
184+ : </csv-options:options>]]></pre>
185 :
186 : All the parameters are optional and can appear in any order.<br/>
187 : All the parameters are case sensitive. The namespace used is "http://www.zorba-xquery.com/modules/converters/csv-options".<br/>
188@@ -292,11 +279,11 @@
189 : <dd>The presence of this element indicates that the first row will contain the header, that is, the names of
190 : the column elements. Only the column names from the first row element are taken into account.<br/>
191 : For example, the row xml:<br/>
192- : <i>&lt;row><br/>
193- : &lt;ID>1&lt;/ID><br/>
194- : &lt;Name>John&lt;/Name><br/>
195- : &lt;Occupation>student&lt;/Occupation><br/>
196- : &lt;/row></i><br/>
197+ : <pre class="ace-static" ace-mode="xquery"><![CDATA[<row>
198+ : <ID>1</ID>
199+ : <Name>John</Name>
200+ : <Occupation>student</Occupation>
201+ : </row>]]></pre>
202 : <br/>
203 : is converted to<br/>
204 : <i>ID,Name,Occupation<br/>
205@@ -309,15 +296,14 @@
206 : When generating the subheaders, the non-whitespace text nodes are also taken into account,
207 : and a separate column is generated for them too.<br/>
208 : For example, the xml row element:<br/>
209- : <i>&lt;row><br/>
210- : &lt;ID>1&lt;/ID><br/>
211- : &lt;Name><br/>
212- : Mr.<br/>
213- : &lt;First_Name>John&lt;/First_Name><br/>
214- : &lt;Last_Name>Howard&lt;/Last_Name><br/>
215- : &lt;/Name><br/>
216- : &lt;Occupation>student&lt;/Occupation><br/>
217- : &lt;/row></i><br/>
218+ : <pre class="ace-static" ace-mode="xquery"><![CDATA[<row>
219+ : <ID>1</ID>
220+ : <Name>
221+ : <First_Name>John</First_Name>
222+ : <Last_Name>Howard</Last_Name>
223+ : </Name>
224+ : <Occupation>student</Occupation>
225+ : </row>]]></pre>
226 : is converted to<br/>
227 : <i>ID,Name,,Occupation<br/>
228 : ,,First Name,Last Name,<br/>
229
230=== modified file 'src/com/zorba-xquery/www/modules/converters/html.xq'
231--- src/com/zorba-xquery/www/modules/converters/html.xq 2011-08-18 23:42:49 +0000
232+++ src/com/zorba-xquery/www/modules/converters/html.xq 2012-09-28 12:53:22 +0000
233@@ -26,7 +26,7 @@
234 :
235 : @author Sorin Nasoi
236 : @library <a href="http://tidy.sourceforge.net/">Tidy C++ Library</a>
237- : @project data processing/data converters
238+ : @project Zorba/Data Converters/HTML
239 :
240 :)
241 module namespace html = "http://www.zorba-xquery.com/modules/converters/html";

Subscribers

People subscribed via source and target branches

to all changes: