XML2YAML(1p)
β¨ 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 isTEXTUAL. other values are"ATTRIBUTES","XML_STRING", and"STRUCTURAL". more details aboutmixed_elementslive inXML::Compile::Translate::Readerif 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 tostdout. 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
- debian trixie: libxml-compile-perl 1.64-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libxml-compile-perl 1.64-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libxml-compile-perl 1.64-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms