DOKK / manpages / debian 10 / libxml-easy-perl / XML::Easy::Content.3pm.en
XML::Easy::Content(3pm) User Contributed Perl Documentation XML::Easy::Content(3pm)

XML::Easy::Content - abstract form of XML content

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

An object of this class represents a chunk of XML content, the kind of matter that can be contained within an XML element. This is in an abstract form, intended for general manipulation. It is completely isolated from the textual representation of XML, and holds only the meaningful content of the chunk. The data in a content object cannot be modified: different data requires the creation of a new object.

An XML content chunk consists of a sequence of zero or more characters and XML elements, interspersed in any fashion. Character content can use almost all Unicode characters, with only a few characters (such as most of the ASCII control characters) prohibited by the specification from being directly represented in XML. Each XML element in a content chunk itself recursively contains a chunk of content, in addition to having attached metadata.

This class is not meant to be subclassed. XML content is unextendable, dumb data. Content objects are better processed using the functions in XML::Easy::NodeBasics than using the methods of this class.

Constructs and returns a new content chunk object with the specified content. TWINE must be a reference to an array listing the chunk's content in twine form (see "Twine" in XML::Easy::NodeBasics). The content is checked for validity, against the XML 1.0 specification, and the function "die"s if it is invalid.

$content->twine
Returns a reference to an array listing the chunk's content in twine form (see "Twine" in XML::Easy::NodeBasics).

The returned array must not be subsequently modified. If possible, it will be marked as read-only in order to prevent modification.

$content->content
Deprecated alias for the "twine" method.

XML::Easy::Element, XML::Easy::NodeBasics

Andrew Main (Zefram) <zefram@fysh.org>

Copyright (C) 2008, 2009 PhotoBox Ltd

Copyright (C) 2009, 2010, 2011, 2017 Andrew Main (Zefram) <zefram@fysh.org>

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2018-11-02 perl v5.28.0