XML::Easy::Content(3) abstract form of XML content


use XML::Easy::Content;
$content = XML::Easy::Content->new([
$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.


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.

Deprecated alias for the ``twine'' method.


Andrew Main (Zefram) <[email protected]>


Copyright (C) 2008, 2009 PhotoBox Ltd

Copyright (C) 2009, 2010, 2011 Andrew Main (Zefram) <[email protected]>


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