• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

ex/H29-May-2012-2722

inc/Module/H29-May-2012-3,1352,352

lib/XML/H29-May-2012-272159

t/H29-May-2012-267194

xt/H29-May-2012-2420

.gitignoreH A D17-May-2012158 1716

ChangesH A D29-May-2012447 2214

LICENSEH A D17-May-2012247 95

MANIFESTH A D29-May-2012559 3130

MANIFEST.SKIPH A D17-May-2012481 3326

META.ymlH A D29-May-2012712 3635

MYMETA.jsonH A D29-May-20121.3 KiB5958

MYMETA.ymlH A D29-May-2012729 3534

Makefile.PLH A D17-May-2012437 2114

READMEH A D29-May-20122.2 KiB8059

README

1NAME
2    XML::Declare - Create XML documents with declaration style
3
4SYNOPSIS
5        my $doc = doc {
6            element feed => sub {
7                attr xmlns => 'http://www.w3.org/2005/Atom';
8                comment "generated using XML::Declare v$XML::Declare::VERSION";
9                for (1..3) {
10                    element entry => sub {
11                        element title     => 'Title', type => 'text';
12                        element content   => sub {
13                            attr type => 'text';
14                            cdata 'Desc';
15                        };
16                        element published => '123123-1231-123-123';
17                        element author => sub {
18                            element name => 'Mons';
19                        }
20                    };
21                }
22            };
23        } '1.0','utf-8';
24
25        print $doc;
26
27        doc { DEFINITIONS } < args to XML::LibXML::Document->new >
28
29        Where DEFINITIONS are
30
31        element name => sub { DEFINITIONS }
32        or
33        element
34            name => 'TextContent',
35            attr => value,
36            attr1 => [qw(more values)];
37
38        attr name => values;
39
40        text $content;
41
42        cdata $content;
43
44        comment $content;
45
46EXPORT
47  doc BLOCK [ $version, $charset ];
48    Create XML::LibXML::Document;
49
50  element $name, sub { ... };
51    Create XML::LibXML::Element with name $name; everything, called within
52    "sub { ... }" will be appended as children to this element
53
54  element $name, ATTRS
55    Create XML::LibXML::Element with name $name and set it's attributes.
56    "ATTRS" is a pairs of "key =" "value">
57
58  attr $name, $value
59    Create XML::LibXML::Attribute with name $name and value $value
60
61  text $content
62    Create XML::LibXML::Text node with content $content
63
64  cdata $content
65    Create XML::LibXML::CDATASection node with content $content
66
67  comment $content
68    Create XML::LibXML::Comment node with content $content
69
70AUTHOR
71    Mons Anderson <mons@cpan.org>
72
73LICENSE AND COPYRIGHT
74    Copyright 2009-2010 Mons Anderson.
75
76    This program is free software; you can redistribute it and/or modify it
77    under the terms of either: the GNU General Public License as published
78    by the Free Software Foundation; or the Artistic License.
79
80