XML::Easy::Content - abstract form of XML content
use XML::Easy::Content; $content = XML::Easy::Content->new([ "foo", $subelement, "bar", ]); $content = $content->content;
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, completely isolated from the textual representation of XML, holding only the meaningful content of the chunk. This is a suitable form for application code to manipulate an XML representation of application data.
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.
An abstract content chunk object cannot be modified. Once created, its properties are fixed. Tasks that you might think of as "modifying an XML node" actually involve creating a new node.
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. The content is checked for validity, against the XML 1.0 specification, and the function dies if it is invalid.
die
CONTENT_ARRAY must be a reference to an array listing the chunk's content in a canonical form. The array must have an odd number of members. The first and last members, and all members in between with an even index, must be strings, and give the chunk's character data. Each member with an odd index must be a reference to an XML::Easy::Element object, representing an XML element contained directly within the chunk. Any of the strings may be empty, if the chunk has no character data between subelements or at the start or end of the chunk.
Returns a reference to an array listing the chunk's content in a canonical form. The array has an odd number of members. The first and last members, and all members in between with an even index, are strings giving the chunk's character data. Each member with an odd index is a reference to an XML::Easy::Element object, representing an XML element contained directly within the chunk. Any of the strings may be empty, if the chunk has no character data between subelements or at the start or end of the chunk.
XML::Easy::Element, XML::Easy::NodeBasics
Andrew Main (Zefram) <zefram@fysh.org>
Copyright (C) 2008 PhotoBox Ltd
Copyright (C) 2009 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.
To install XML::Easy, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XML::Easy
CPAN shell
perl -MCPAN -e shell install XML::Easy
For more information on module installation, please visit the detailed CPAN module installation guide.