]> gitweb.factorcode.org Git - factor.git/blob - extra/msxml-to-csv/msxml-to-csv.factor
Merge branch 'master' of git://factorcode.org/git/factor into unicode
[factor.git] / extra / msxml-to-csv / msxml-to-csv.factor
1 USING: io io.files sequences xml xml.utilities
2 io.encodings.ascii kernel ;
3 IN: msxml-to-csv
4
5 : (msxml>csv) ( xml -- table )
6     "Worksheet" tag-named
7     "Table" tag-named
8     "Row" tags-named [
9         "Cell" tags-named [
10             "Data" tag-named children>string
11         ] map
12     ] map ;
13
14 : msxml>csv ( outfile infile -- )
15     file>xml (msxml>csv) [ "," join ] map
16     swap ascii set-file-lines ;