Andrew Main (Zefram) > XML-Easy-0.009 > XML::Easy::Content

Download:
XML-Easy-0.009.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  2
View/Report Bugs
Module Version: 0.009   Source  

NAME ^

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

SYNOPSIS ^

        use XML::Easy::Content;

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

        $twine = $content->twine;

DESCRIPTION ^

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.

CONSTRUCTOR ^

XML::Easy::Content->new(TWINE)

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 dies if it is invalid.

METHODS ^

$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.

SEE ALSO ^

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

AUTHOR ^

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

COPYRIGHT ^

Copyright (C) 2008, 2009 PhotoBox Ltd

Copyright (C) 2009, 2010, 2011 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.

syntax highlighting: