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