| 1 | =head1 NAME | ||||||||||
| 2 | |||||||||||
| 3 | XML::Easy::Content - abstract form of XML content | ||||||||||
| 4 | |||||||||||
| 5 | =head1 SYNOPSIS | ||||||||||
| 6 | |||||||||||
| 7 | use XML::Easy::Content; | ||||||||||
| 8 | |||||||||||
| 9 | $content = XML::Easy::Content->new([ | ||||||||||
| 10 | "foo", | ||||||||||
| 11 | $subelement, | ||||||||||
| 12 | "bar", | ||||||||||
| 13 | ]); | ||||||||||
| 14 | |||||||||||
| 15 | $twine = $content->twine; | ||||||||||
| 16 | |||||||||||
| 17 | =head1 DESCRIPTION | ||||||||||
| 18 | |||||||||||
| 19 | An object of this class represents a chunk of XML content, the kind | ||||||||||
| 20 | of matter that can be contained within an XML element. This is in an | ||||||||||
| 21 | abstract form, intended for general manipulation. It is completely | ||||||||||
| 22 | isolated from the textual representation of XML, and holds only the | ||||||||||
| 23 | meaningful content of the chunk. The data in a content object cannot | ||||||||||
| 24 | be modified: different data requires the creation of a new object. | ||||||||||
| 25 | |||||||||||
| 26 | An XML content chunk consists of a sequence of zero or more characters | ||||||||||
| 27 | and XML elements, interspersed in any fashion. Character content can | ||||||||||
| 28 | use almost all Unicode characters, with only a few characters (such as | ||||||||||
| 29 | most of the ASCII control characters) prohibited by the specification | ||||||||||
| 30 | from being directly represented in XML. Each XML element in a content | ||||||||||
| 31 | chunk itself recursively contains a chunk of content, in addition to | ||||||||||
| 32 | having attached metadata. | ||||||||||
| 33 | |||||||||||
| 34 | This class is not meant to be subclassed. XML content is unextendable, | ||||||||||
| 35 | dumb data. Content objects are better processed using the functions in | ||||||||||
| 36 | L<XML::Easy::NodeBasics> than using the methods of this class. | ||||||||||
| 37 | |||||||||||
| 38 | =cut | ||||||||||
| 39 | |||||||||||
| 40 | package XML::Easy::Content; | ||||||||||
| 41 | |||||||||||
| 42 | 15 | ▶ | { use 5.008; } | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 43 | 15 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 44 | 15 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 45 | |||||||||||
| 46 | 15 | our $VERSION = "0.010"; | |||||||||
| 47 | |||||||||||
| 48 | 15 | eval { local $SIG{__DIE__}; | |||||||||
| 49 | 15 | require XSLoader; | |||||||||
| 50 | 15 | ▶ | XSLoader::load("XML::Easy", $VERSION) unless defined &new; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | }; | ||||||||||
| 52 | |||||||||||
| 53 | 15 | ▶ | if($@ eq "") { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 54 | 0 | close(DATA); | |||||||||
| 55 | } else { | ||||||||||
| 56 | 15 | (my $filename = __FILE__) =~ tr# -~##cd; | |||||||||
| 57 | 15 | local $/ = undef; | |||||||||
| 58 | 15 | my $pp_code = "#line 75 \"$filename\"\n".<DATA>; | |||||||||
| 59 | 15 | close(DATA); | |||||||||
| 60 | { | ||||||||||
| 61 | 15 | local $SIG{__DIE__}; | |||||||||
| 62 | 15 | eval $pp_code; | |||||||||
| 63 | } | ||||||||||
| 64 | 15 | ▶ | die $@ if $@ ne ""; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 65 | } | ||||||||||
| 66 | |||||||||||
| 67 | 15 | *content = \&twine; | |||||||||
| 68 | |||||||||||
| 69 | 15 | 1; | |||||||||
| 70 | |||||||||||
| 71 | __DATA__ | ||||||||||