line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
XML::Easy - XML processing with a clean interface |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use XML::Easy::NodeBasics qw(xml_element xml_e_attribute); |
8
|
|
|
|
|
|
|
use XML::Easy::Text |
9
|
|
|
|
|
|
|
qw(xml10_read_document xml10_write_document); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
$element = xml_element("a", { href => "there" }, "there"); |
12
|
|
|
|
|
|
|
$element = xml10_read_document('there'); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$href = xml_e_attribute($element, "href"); |
15
|
|
|
|
|
|
|
$text = xml10_write_document($element); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# see specific modules for many more functions |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 DESCRIPTION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
L is a collection of modules relating to the processing, |
22
|
|
|
|
|
|
|
parsing, and serialisation of XML data. It is oriented towards the |
23
|
|
|
|
|
|
|
use of XML to represent data for interchange purposes, rather than the |
24
|
|
|
|
|
|
|
use of XML as markup of principally textual data. It does not perform |
25
|
|
|
|
|
|
|
any schema processing, and does not interpret DTDs or any other kind |
26
|
|
|
|
|
|
|
of schema. It adheres strictly to the XML specification, in all its |
27
|
|
|
|
|
|
|
awkward details, except for the aforementioned DTDs. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
L strictly separates the in-program manipulation of XML |
30
|
|
|
|
|
|
|
data from the processing of the textual form of XML. This shields |
31
|
|
|
|
|
|
|
the XML user from the inconvenient and obscure aspects of XML syntax. |
32
|
|
|
|
|
|
|
XML data nodes are mainly processed in a clean functional style, using |
33
|
|
|
|
|
|
|
the L module. In the (very likely) event that |
34
|
|
|
|
|
|
|
an application requires some more purpose-specific XML data processing |
35
|
|
|
|
|
|
|
facilities, they are readily built on top of L, |
36
|
|
|
|
|
|
|
retaining the abstraction from textual XML. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
When XML must be handled in textual form, for input and output, |
39
|
|
|
|
|
|
|
the L module supplies a parser and a serialiser. |
40
|
|
|
|
|
|
|
The interfaces here, too, are functional in nature. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
There are other modules for some ancillary aspects of XML processing. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 MODULES |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
The modules in the L distribution are: |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=over |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=item L |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
This document. For historical reasons, this can also be loaded as |
53
|
|
|
|
|
|
|
a module, and (though it is deprecated) some of the functions from |
54
|
|
|
|
|
|
|
L can be imported from here. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item L |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
This module provides various type-testing functions, relating to data |
59
|
|
|
|
|
|
|
types used in the L ensemble. These are mainly intended to be |
60
|
|
|
|
|
|
|
used to enforce validity of data being processed by XML-related functions. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item L |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item L |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
These are classes used to represent XML data for general manipulation. |
67
|
|
|
|
|
|
|
Objects of these classes hold the meaningful content of the data, |
68
|
|
|
|
|
|
|
independent of textual representation. The data in these nodes cannot |
69
|
|
|
|
|
|
|
be modified: different data requires new nodes. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item L |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
This module supplies functions concerned with the creation, examination, |
74
|
|
|
|
|
|
|
and other manipulation of XML data nodes (content chunks and elements). |
75
|
|
|
|
|
|
|
The nodes are dumb data objects, best manipulated using plain functions |
76
|
|
|
|
|
|
|
such as the ones in this module. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item L |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This module supplies Perl regular expressions describing the grammar of |
81
|
|
|
|
|
|
|
XML 1.0. This is intended to support doing irregular things with XML, |
82
|
|
|
|
|
|
|
rather than for normal parsing. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item L |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This module supplies functions that parse and serialise XML data as text |
87
|
|
|
|
|
|
|
according to the XML 1.0 specification. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=back |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 OTHER DISTRIBUTIONS |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Other CPAN distributions that work with L are: |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=over |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=item L |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
A testing tool, providing L-style functions that check |
100
|
|
|
|
|
|
|
whether XML nodes are as expected. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item L |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Provides a way to construct XML data nodes by procedural code. |
105
|
|
|
|
|
|
|
Some programmers will find this more comfortable than the functional |
106
|
|
|
|
|
|
|
style offered by L. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item L |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Helps to parse things that are encoded in XML in common ways. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item C |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
This namespace exists to contain modules that perform transformations |
115
|
|
|
|
|
|
|
on XML documents, or parts thereof, in the form of L |
116
|
|
|
|
|
|
|
and L nodes. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=back |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
package XML::Easy; |
123
|
|
|
|
|
|
|
|
124
|
2
|
|
|
2
|
|
29472
|
{ use 5.008; } |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
95
|
|
125
|
2
|
|
|
2
|
|
15
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
66
|
|
126
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
128
|
|
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
our $VERSION = "0.009"; |
129
|
|
|
|
|
|
|
|
130
|
2
|
|
|
2
|
|
2846
|
use parent "Exporter"; |
|
2
|
|
|
|
|
734
|
|
|
2
|
|
|
|
|
18
|
|
131
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
132
|
|
|
|
|
|
|
xml10_read_content xml10_read_element |
133
|
|
|
|
|
|
|
xml10_read_document xml10_read_extparsedent |
134
|
|
|
|
|
|
|
xml10_write_content xml10_write_element |
135
|
|
|
|
|
|
|
xml10_write_document xml10_write_extparsedent |
136
|
|
|
|
|
|
|
); |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
require XML::Easy::Text; |
139
|
|
|
|
|
|
|
XML::Easy::Text->VERSION($VERSION); |
140
|
|
|
|
|
|
|
XML::Easy::Text->import(@EXPORT_OK); |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 SEE ALSO |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
L, |
145
|
|
|
|
|
|
|
L, |
146
|
|
|
|
|
|
|
L, |
147
|
|
|
|
|
|
|
L, |
148
|
|
|
|
|
|
|
L |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 AUTHOR |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Andrew Main (Zefram) |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 COPYRIGHT |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Copyright (C) 2008, 2009 PhotoBox Ltd |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Copyright (C) 2009, 2010, 2011 Andrew Main (Zefram) |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 LICENSE |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it |
163
|
|
|
|
|
|
|
under the same terms as Perl itself. |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=cut |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
1; |