1Fsdb::Filter::xml_to_dbU(s3e)r Contributed Perl DocumentaFtsidobn::Filter::xml_to_db(3)
2
3
4

NAME

6       xml_to_db - convert a subset of XML into fsdb
7

SYNOPSIS

9           xml_to_db -k EntityField <source.xml
10

DESCRIPTION

12       Converts a very limited subset of XML into Fsdb format.
13
14       The input is XML-format (not fsdb).  The input is parsed as XML, and
15       each entity of type ENTITYFIELD is extracted as a row.  ENTITYFIELD can
16       have mutliple components separated by slashes to walk down the XML
17       tree, if necessary.
18
19       The input XML file is assumed to be very simple.  All rows are assumed
20       to be sequential in one entity.  Any other than the specified
21       ENTITYFIELD are ignored.  The schema is assumed to be defined by the
22       first instances of that field.
23
24       The output is two-space-separated fsdb.  (Someday more general field
25       separators should be supported.)  Fsdb fields are normalized version of
26       the CSV file: spaces are converted to single underscores.
27

OPTIONS

29       -e EmptyValue or --empty
30           Specify the value newly created columns get.
31
32       This module also supports the standard fsdb options:
33
34       -d  Enable debugging output.
35
36       -i or --input InputSource
37           Read from InputSource, typically a file name, or "-" for standard
38           input, or (if in Perl) a IO::Handle, Fsdb::IO or Fsdb::BoundedQueue
39           objects.
40
41       -o or --output OutputDestination
42           Write to OutputDestination, typically a file name, or "-" for
43           standard output, or (if in Perl) a IO::Handle, Fsdb::IO or
44           Fsdb::BoundedQueue objects.
45
46       --autorun or --noautorun
47           By default, programs process automatically, but Fsdb::Filter
48           objects in Perl do not run until you invoke the run() method.  The
49           "--(no)autorun" option controls that behavior within Perl.
50
51       --help
52           Show help.
53
54       --man
55           Show full manual.
56

SAMPLE USAGE

58   Input:
59               <?xml version='1.0' standalone='yes'?>
60               <gnuPod>
61                <files>
62                 <file addtime="3389919728" album="Born to Pick" artist="7th Day Buskers" title="Loch Lamor" />
63                 <file addtime="3389919728" album="Born to Pick" artist="7th Day Buskers" title="The Floods" />
64                 <file addtime="3389919735" album="Copland Conducts Copland" artist="Aaron Copland" title="Our Town" />
65                </files>
66                <playlist name="new shows" plid="97241" >
67                  <regex artist="^(Le Show|This American Life)$" />
68                </playlist>
69               </gnuPod>
70
71   Command:
72               xml_to_db -k files/file <gnupod.xml
73
74   Output:
75               #fsdb -F S addtime album artist title
76               3389919728  Born to Pick  7th Day Buskers  Loch Lamor
77               3389919728  Born to Pick  7th Day Buskers  The Floods
78               3389919735  Copland Conducts Copland  Aaron Copland  Our Town
79               #   | xml_to_db -k files/file
80

SEE ALSO

82       Fsdb.
83

CLASS FUNCTIONS

85   new
86           $filter = new Fsdb::Filter::xml_to_db(@arguments);
87
88       Create a new xml_to_db object, taking command-line arguments.
89
90   set_defaults
91           $filter->set_defaults();
92
93       Internal: set up defaults.
94
95   parse_options
96           $filter->parse_options(@ARGV);
97
98       Internal: parse command-line arguments.
99
100   _find_entities
101           $filter->_find_entities
102
103       Internal: walk the ENTITYFIELD specification through the XML::Simple
104       data structure.  Returns an aref.
105
106   setup
107           $filter->setup();
108
109       Internal: setup, parse headers.
110
111   run
112           $filter->run();
113
114       Internal: run over each rows.
115
117       Copyright (C) 2011-2018 by John Heidemann <johnh@isi.edu>
118
119       This program is distributed under terms of the GNU general public
120       license, version 2.  See the file COPYING with the distribution for
121       details.
122
123
124
125perl v5.30.1                      2020-01-30        Fsdb::Filter::xml_to_db(3)
Impressum