XML_TO_DB(1)
π XML_TO_DB β like, the manual page, bestie β¨
Okay so first things first: this is xml_to_db(1), and it lives in the User Contributed Perl Documentation section of your man pages. Cute, right? Let's get into it π«Ά
πΈ NAME πΈ
xml_to_db β it converts a subset of XML into fsdb. That's the whole vibe. β¨
π SYNOPSIS π
xml_to_db -k EntityField <source.xml
That's it. That's the whole invocation. Iconic behavior honestly π
π¦ DESCRIPTION π¦
Okay so here's the tea: this thing converts a very limited subset of XML into Fsdb format. Like, very limited. Don't come at it with your whole fancy XML situation, it's not that kind of program π
The input is XML-format (not fsdb, okay? not fsdb). The input gets parsed as XML, and then each entity of type ENTITYFIELD gets extracted as a row. And bestie, ENTITYFIELD can have multiple components separated by slashes to walk down the XML tree, if necessary β so you can go digging down in there π§
The input XML file is assumed to be very simple. All rows are assumed to be sequential in one entity. Anything that isn't the specified ENTITYFIELD? Ignored. Not even looked at. The schema is assumed to be defined by the first instances of that field. That's the assumption, no cap.
The output is two-space-separated fsdb. (Someday more general field separators should be supported, but like... not today.) Fsdb fields are a normalized version of the CSV file: spaces are converted to single underscores. Slay π
β¨ OPTIONS β¨
-eEmptyValue,--emptyβ specify the value newly created columns get. Because fresh columns need a little something π
This module also supports the standard fsdb options:
-dβ enable debugging output. For when you need to see what's going on in there π-iInputSource,--inputβ read from InputSource, typically a file name, or"-"for standard input, or (if you're in Perl) aIO::Handle,Fsdb::IOorFsdb::BoundedQueueobject. So many options, so little time π-oOutputDestination,--outputβ write to OutputDestination, typically a file name, or"-"for standard output, or (if you're in Perl) aIO::Handle,Fsdb::IOorFsdb::BoundedQueueobject. Same energy, output edition π--autorun,--noautorunβ by default, programs process automatically, butFsdb::Filterobjects in Perl do not run until you invoke therun()method. The--(no)autorunoption controls that behavior within Perl. Main character energy: you decide when it goes π«Ά--helpβ show help. We love a helpful icon π--manβ show full manual. Hi, you're already here! π
π SAMPLE USAGE π
π Input:
<?xml version='1.0' standalone='yes'?>
<gnuPod>
<files>
<file addtime="3389919728" album="Born to Pick" artist="7th Day Buskers" title="Loch Lamor" />
<file addtime="3389919728" album="Born to Pick" artist="7th Day Buskers" title="The Floods" />
<file addtime="3389919735" album="Copland Conducts Copland" artist="Aaron Copland" title="Our Town" />
</files>
<playlist name="new shows" plid="97241" >
<regex artist="^(Le Show|This American Life)$" />
</playlist>
</gnuPod>
π Command:
xml_to_db -k files/file <gnupod.xml
β Output:
#fsdb -F S addtime album artist title
3389919728 Born to Pick 7th Day Buskers Loch Lamor
3389919728 Born to Pick 7th Day Buskers The Floods
3389919735 Copland Conducts Copland Aaron Copland Our Town
# | xml_to_db -k files/file
Look at that transformation. Ate and left no crumbs π₯
π SEE ALSO π
Fsdb. That's it, that's the whole list π
π AUTHOR and COPYRIGHT π
Copyright (C) 2011-2018 by John Heidemann <johnh@isi.edu>
This program is distributed under terms of the GNU general public license, version 2. See the file COPYING with the distribution for details.
Heads up bestie: it's GNU GPL v2, so read COPYING if you wanna know the rules fr fr π
And that's the whole page! π Big sign-off energy: this was perl v5.32.1, dated 2024-08-02, and honestly? She's giving classic. Periodt. π¦πΈπ
π¦ where this page comes from
- epel 9: perl-Fsdb 2:3.9-1.el9 Β· GPLv2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms