XML2YAML(1p)

πŸ“¦
version 1.64 Β· 3 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

✨ NAME ✨

xml2yaml β€” convert an XML message with a schema into YAML πŸ’–

okay so bestie, this is XML2YAML(1p), a lil Perl script that takes your XML and turns it into YAML. no cap.


πŸ¦‹ SYNOPSIS πŸ¦‹

xml2yaml xml-file schema-file(s)  >yaml-file

xml2yaml -x xml-file -s schema-files -o yaml-file

🌸 DESCRIPTION 🌸

It converts an XML message into YAML with the same structure. periodt. πŸ’…

You need a schema though β€” like, it's required, not optional β€” because that's what enforces the correct syntax, especially for optionally repeated elements (iykyk, those get messy without a schema).

πŸŽ€ Options πŸŽ€

So you've got two vibes to choose from: either you pass an XML message filename plus one or more schema filenames as plain arguments, or you use the options. both are valid, pick your main character energy. ✨

  • --xml|-x filename β€” the file with the xml message in it. a single dash means "stdin", because of course it does. πŸ’€
  • --schema|-s filename(s) β€” this one can be repeated, or you can separate the filenames with commas, if you've got more than one schema file to parse. heads up though: all imported and included schema components have to be provided explicitly. no sneaky auto-discovery here bestie. 😭
  • --bigints|-b (boolean) β€” by default the translation is a little sloppy: Integer types are defined to support at least 18 digits in XML. but honestly? that's usually unnecessarily large and unreadable in YAML. so this flag exists. 🫢
  • --no-keep-root (boolean) β€” do not include the top node in the output. bye bestie πŸ‘‹
  • --mixed HOW β€” [1.32] how to treat mixed elements. the default is TEXTUAL. other values are "ATTRIBUTES", "XML_STRING", and "STRUCTURAL". more details about mixed_elements live in XML::Compile::Translate::Reader if you wanna go deep. πŸ”₯
  • --type|-t TYPE β€” the type of the root element. this is required if the XML is not namespace-qualified, even though the schema is. if you don't specify it, the root element is automatically inspected. πŸ‘‘

the TYPE notation is "{namespace}localname". be warned to use quoting on the UNIX command-line, because curly braces have a special meaning for the shell. don't get got. πŸ™ˆ

  • --output|-o filename β€” by default (or when the filename is a dash), the output is printed to stdout. classic. 🌈

πŸ’œ SEE ALSO πŸ’œ

This module is part of Perl's XML-Compile distribution. Website: http://perl.overmeer.net/xml-compile/ 🌐


⭐ LICENSE ⭐

Copyrights 2008 by Slaven Rezic and Mark Overmeer. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html πŸ“œ


okay that's the whole page bestie, slay. πŸ’– this was perl v5.40.0, dated 2024-10-27, and it's giving <rainbow>XML2YAML(1p)</rainbow> energy all day every day. go convert something iconic βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from