XML_TO_DB(1)

πŸ“¦
version 3.9 Β· 3 versions
, in epel 9

πŸ’… 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 ✨

  • -e EmptyValue, --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 πŸ‘€
  • -i InputSource, --input β€” read from InputSource, typically a file name, or "-" for standard input, or (if you're in Perl) a IO::Handle, Fsdb::IO or Fsdb::BoundedQueue object. So many options, so little time 🌈
  • -o OutputDestination, --output β€” write to OutputDestination, typically a file name, or "-" for standard output, or (if you're in Perl) a IO::Handle, Fsdb::IO or Fsdb::BoundedQueue object. Same energy, output edition πŸ’œ
  • --autorun, --noautorun β€” by default, programs process automatically, but Fsdb::Filter objects in Perl do not run until you invoke the run() method. The --(no)autorun option 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 😭


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