XML::E...ontent(3pm)

πŸ’– NAME πŸ’–

XML::Easy::Content β€” the abstract form of XML content, bestie ✨


🌸 SYNOPSIS 🌸

use XML::Easy::Content;

$content = XML::Easy::Content->new([
                "foo",
                $subelement,
                "bar",
            ]);

$twine = $content->twine;

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so picture this: an object of this class is literally a chunk of XML content β€” the exact kind of matter that can live inside an XML element 🫢. But it's in an abstract form, made for general manipulation, iykyk. It is completely, totally isolated from the textual representation of XML β€” it holds only the meaningful content of the chunk, no vibes wasted πŸ’…. And here's the thing: the data in a content object cannot be modified. Nope. Not happening. Different data means you go make a whole new object, periodt.

An XML content chunk is a sequence of zero or more characters and XML elements, interspersed in any order you like πŸŽ€. Character content can use almost all Unicode characters β€” with only a few exceptions (like most of the ASCII control characters) that the spec straight-up prohibits from being directly represented in XML. Respect the constraints, bestie. And every XML element inside a content chunk recursively contains its own chunk of content, plus it's got metadata attached, main character energy all the way down 🌈.

Heads up: this class is not meant to be subclassed. XML content is unextendable, dumb data β€” it's giving "no thoughts, head empty" 🧚. You're way better off processing content objects using the functions in XML::Easy::NodeBasics than using the methods of this class. Fr fr.

✨ CONSTRUCTOR ✨

  • XML::Easy::Content->new(TWINE) β€” makes a fresh new content chunk object and hands it back to you, holding exactly the content you specified πŸ’–. TWINE has to be a reference to an array that lists the chunk's content in twine form (go read "Twine" in XML::Easy::NodeBasics for the tea β˜•). Then the content gets checked for validity against the XML 1.0 specification, and if it's invalid the function dies. So yes, invalid input = your program goes bye-bye 😭.

πŸ’… METHODS πŸ’…

  • $content->twine β€” returns a reference to an array listing the chunk's content in twine form (again: "Twine" in XML::Easy::NodeBasics). 🫢
MAJOR WARNING: the returned array must not be subsequently modified. Not even a little. If it's possible, it'll get marked as read-only just to stop you from doing it anyway πŸ™ˆ.
  • $content->content β€” deprecated alias for the twine method. It's giving old news, but it's still there πŸ‘‘.

πŸŽ€ SEE ALSO πŸŽ€

  • XML::Easy::Element
  • XML::Easy::NodeBasics

🌟 AUTHOR 🌟

Andrew Main (Zefram) <zefram@fysh.org> β€” iconic, we stan πŸ’œ


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. Slay πŸ’…βœ¨


That's the whole page, bestie β€” brought to you by the User Contributed Perl Documentation crew, running on perl v5.42.3, dated 2026-08-22. Mwah, go write some XML πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from