Catman...ml_read(3pm)
π Catman...ml_read β aka Catmandu::Fix::xml_read π
okay bestie, come CLOSE because this one is a Catmandu::Fix from the User Contributed Perl Documentation (that's the 3pm girlies β¨), and she is here to turn your messy little XML strings into MicroXML or simple XML. No cap. π¦
β¨ NAME β¨
Catmandu::Fix::xml_read β parse XML to MicroXML. That's it, that's the whole job, and she eats every time. π
πΈ SYNOPSIS πΈ
# parse XML string given in field 'xml'
xml_read(xml)
xml_read(xml, simple: 1)
xml_read(xml, attributes: 0)
Look at her. Three lines. Iconic behavior only. π
π DESCRIPTION π
So, this Catmandu::Fix literally parses XML strings into MicroXML or simple XML, and she does it with XML::Struct. That's the whole vibe. She takes your XML and makes it make sense. π«Ά
π§ CONFIGURATION π§
Vibe check time: the parsing can be configured with the following options of XML::Struct::Reader. Yes, all of them. We're listing every single one, because we don't skip. Periodt. π
attributesβ include XML attributes. Enabled by default, so she's already doing this unless you tell her not to. β¨nsβ define processing of XML namespaces. The default is"keep", so namespaces stay right where they are. πwhitespaceβ include ignorable whitespace as text elements. Disabled by default (so by default that whitespace is getting ignored, respectfully). πsimpleβ convert to a simple key-value structure, as known fromXML::Simple. Classic behavior, honestly.rootβ keep (and possibly rename) the root element when converting to"simple"form. She said the root stays, or gets a glow-up name. πdepthβ only transform to a given depth, and only with thesimpleoption. So like, don't go all the way down, bestie, just to that depth. π¦pathβ parse only given elements (and all of its child elements) and return as an array. For instancepath => "p"in an XHTML document would return a list of parsed paragraphs (<p>...</p>). Careful, queen: this option overrides optionroot. π«Άcontentβ name of text content when converting to"simple"form. Give that text content a name, she deserves one. πΈ
π SEE ALSO π
Go give these girls a follow, they're all in the same friend group:
Catmandu::Fix::xml_write,Catmandu::Fix::xml_simpleCatmandu::Fix::xml_transform
k that's the whole page bestie, you're so welcome π
This little manual page is serving perl v5.36.0, dated 2022-09-15, and it's brought to you by the User Contributed Perl Documentation girlies. mwah, drink water, xml_read responsibly πβ¨π
π¦ where this page comes from
- ubuntu noble: libcatmandu-xml-perl 0.17-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcatmandu-xml-perl 0.17-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-xml-perl 0.17-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