| 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('<a href="there">there</a>'); | ||
| 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<XML::Easy> 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<XML::Easy> 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<XML::Easy::NodeBasics> 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<XML::Easy::NodeBasics>, | ||
| 36 | retaining the abstraction from textual XML. | ||
| 37 | |||
| 38 | When XML must be handled in textual form, for input and output, | ||
| 39 | the L<XML::Easy::Text> 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<XML::Easy> distribution are: | ||
| 47 | |||
| 48 | =over | ||
| 49 | |||
| 50 | =item L<XML::Easy> | ||
| 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<XML::Easy::Text> can be imported from here. | ||
| 55 | |||
| 56 | =item L<XML::Easy::Classify> | ||
| 57 | |||
| 58 | This module provides various type-testing functions, relating to data | ||
| 59 | types used in the L<XML::Easy> ensemble. These are mainly intended to be | ||
| 60 | used to enforce validity of data being processed by XML-related functions. | ||
| 61 | |||
| 62 | =item L<XML::Easy::Content> | ||
| 63 | |||
| 64 | =item L<XML::Easy::Element> | ||
| 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<XML::Easy::NodeBasics> | ||
| 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<XML::Easy::Syntax> | ||
| 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<XML::Easy::Text> | ||
| 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<XML::Easy> are: | ||
| 94 | |||
| 95 | =over | ||
| 96 | |||
| 97 | =item L<Test::XML::Easy> | ||
| 98 | |||
| 99 | A testing tool, providing L<Test::More>-style functions that check | ||
| 100 | whether XML nodes are as expected. | ||
| 101 | |||
| 102 | =item L<XML::Easy::ProceduralWriter> | ||
| 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<XML::Easy::NodeBasics>. | ||
| 107 | |||
| 108 | =item L<XML::Easy::SimpleSchemaUtil> | ||
| 109 | |||
| 110 | Helps to parse things that are encoded in XML in common ways. | ||
| 111 | |||
| 112 | =item C<XML::Easy::Transform::> | ||
| 113 | |||
| 114 | This namespace exists to contain modules that perform transformations | ||
| 115 | on XML documents, or parts thereof, in the form of L<XML::Easy::Element> | ||
| 116 | and L<XML::Easy::Content> nodes. | ||
| 117 | |||
| 118 | =back | ||
| 119 | |||
| 120 | =cut | ||
| 121 | |||
| 122 | package XML::Easy; | ||
| 123 | |||
| 124 | 5 | ▶ | { use 5.008; } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 125 | 5 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 126 | 5 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 127 | |||
| 128 | 5 | our $VERSION = "0.010"; | |
| 129 | |||
| 130 | 5 | ▶ | use parent "Exporter"; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 131 | 5 | 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 | 5 | require XML::Easy::Text; | |
| 139 | 5 | XML::Easy::Text->VERSION($VERSION); | |
| 140 | 5 | XML::Easy::Text->import(@EXPORT_OK); | |
| 141 | |||
| 142 | =head1 SEE ALSO | ||
| 143 | |||
| 144 | L<XML::Easy::Classify>, | ||
| 145 | L<XML::Easy::NodeBasics>, | ||
| 146 | L<XML::Easy::Syntax>, | ||
| 147 | L<XML::Easy::Text>, | ||
| 148 | L<http://www.w3.org/TR/REC-xml/> | ||
| 149 | |||
| 150 | =head1 AUTHOR | ||
| 151 | |||
| 152 | Andrew Main (Zefram) <zefram@fysh.org> | ||
| 153 | |||
| 154 | =head1 COPYRIGHT | ||
| 155 | |||
| 156 | Copyright (C) 2008, 2009 PhotoBox Ltd | ||
| 157 | |||
| 158 | Copyright (C) 2009, 2010, 2011, 2017 | ||
| 159 | Andrew Main (Zefram) <zefram@fysh.org> | ||
| 160 | |||
| 161 | =head1 LICENSE | ||
| 162 | |||
| 163 | This module is free software; you can redistribute it and/or modify it | ||
| 164 | under the same terms as Perl itself. | ||
| 165 | |||
| 166 | =cut | ||
| 167 | |||
| 168 | 5 | 1; | |