XML::Easy(3pm)
β¨ NAME β¨
XML::Easy β XML processing with a clean interface π (yes bestie, the whole API is literally this chill)
πΈ SYNOPSIS πΈ
use XML::Easy::NodeBasics qw(xml_element xml_e_attribute);
use XML::Easy::Text qw(xml10_read_document xml10_write_document);
$element = xml_element("a", { href => "there" }, "there");
$element = xml10_read_document('<a href="there">there</a>');
$href = xml_e_attribute($element, "href");
$text = xml10_write_document($element);
# see specific modules for many more functions
Like, that's the whole vibe right there. You make an element, you read a document, you grab an attribute, you write it back out. Iconic. And fr fr, that last comment is not a joke β `go look at the specific modules, there's so much more. π
π¦ DESCRIPTION π¦
XML::Easy is a whole little collection of modules that deal with processing, parsing, and serialisation of XML data. Ok so the whole point of it: it's oriented toward using XML to represent data for interchange purposes, not toward using XML as markup for principally textual data. So if you're out here trying to mark up a document like it's a fancy text file, this is not your girl. If you're shipping data around, hi bestie, come in.
It does not do any schema processing, and it does not interpret DTDs or any other kind of schema. Periodt. It adheres strictly to the XML specification β in all its awkward details β except for those aforementioned DTDs. Awkward details included, no cap.
XML::Easy strictly separates the in-program manipulation of XML data from the processing of the textual form of XML. That's the whole slay. It shields you, the XML user, from the inconvenient and obscure aspects of XML syntax. β¨ XML data nodes are mainly processed in a clean functional style, using the XML::Easy::NodeBasics module. And in the (very likely) event that an application needs some more purpose-specific XML data processing facilities, they're readily built on top of XML::Easy::NodeBasics, retaining the abstraction from textual XML. So you build up, you don't hack sideways. π
When XML actually has to be handled in textual form β for input and output β the XML::Easy::Text module supplies a parser and a serialiser. And the interfaces here too are functional in nature. Consistent. We love that for us.
There are other modules for some ancillary aspects of XML processing. (See below, boo. We got you. π)
π Minimum Perl Version π
So, the code in this library's modules was originally written to accommodate perl-5.8, but its prerequisites are in large part no longer working on that version of perl. π Tragic. So as of XML-Easy-0.012 we set perl-5.10.1 as our recommended minimum Perl version. Bookmark that, bestie. π
π MODULES π
The modules in the XML::Easy distribution are:
XML::Easyβ this document right here π. For historical reasons, this can also be loaded as a module, and (though it is deprecated) some of the functions fromXML::Easy::Textcan be imported from here. So like... technically yes, but also don't.XML::Easy::Classifyβ provides various type-testing functions, relating to data types used in theXML::Easyensemble. These are mainly intended to be used to enforce validity of data being processed by XML-related functions. Valid, or else. πXML::Easy::ContentandXML::Easy::Elementβ these are classes used to represent XML data for general manipulation. Objects of these classes hold the meaningful content of the data, independent of textual representation. And here's the tea: the data in these nodes cannot be modified β different data requires new nodes. Immutable. Main character behaviour honestly. β¨XML::Easy::NodeBasicsβ supplies functions concerned with the creation, examination, and other manipulation of XML data nodes (content chunks and elements). The nodes are dumb data objects, best manipulated using plain functions such as the ones in this module. Dumb data, smart functions. That's the dynamic. π«ΆXML::Easy::Syntaxβ supplies Perl regular expressions describing the grammar of XML 1.0. This is intended to support doing irregular things with XML, rather than for normal parsing. Chaos mode enabled. π₯XML::Easy::Textβ supplies functions that parse and serialise XML data as text according to the XML 1.0 specification. The actual text-to-XML and XML-to-text girlies. π
π OTHER DISTRIBUTIONS π
Other CPAN distributions that work with XML::Easy are:
Test::XML::Easyβ a testing tool, providingTest::More-style functions that check whether XML nodes are as expected. Vibe check but for nodes. βXML::Easy::ProceduralWriterβ provides a way to construct XML data nodes by procedural code. Some programmers will find this more comfortable than the functional style offered byXML::Easy::NodeBasics. Different strokes, no judgement here bestie. π¦XML::Easy::SimpleSchemaUtilβ helps to parse things that are encoded in XML in common ways. Common ways only. We stay in our lane. π"XML::Easy::Transform::"β this namespace exists to contain modules that perform transformations on XML documents, or parts thereof, in the form ofXML::Easy::ElementandXML::Easy::Contentnodes. Transformative. β¨
β SEE ALSO β
XML::Easy::Classify, XML::Easy::NodeBasics, XML::Easy::Syntax, XML::Easy::Text, <http://www.w3.org/TR/REC-xml/
Like, go read the spec if you want the lore. It's giving β¨required readingβ¨.
π AUTHOR π
Andrew Main (Zefram) <zefram@fysh.org> (deceased March 10 2025)
ποΈ Rest in peace, legend. Your clean interface lives on.
π Maintainer π
James E Keenan (jkeenan@cpan.org), beginning with version 0.012
Holding it down. π«Ά
π COPYRIGHT π
Copyright (C) 2008, 2009 PhotoBox Ltd
Copyright (C) 2009, 2010, 2011, 2017 Andrew Main (Zefram) <zefram@fysh.org>
π§ LICENSE π§
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Ok bestie, that's the whole page. π Everything's here, nothing got dropped, and now you know how to handle XML data without crying. Go build something iconic. πΈπ
This page ships with perl v5.42.3, dated 2026-08-22, from the XML::Easy(3pm) manual β catch you in the group chat. ππ«Ά
π¦ where this page comes from
- ubuntu stonking: libxml-easy-perl 0.014-1build1 Β· 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