XML::Writer::Simple - Create XML files easily!
Version 0.01
use XML::Writer::Simple dtd => "file.dtd"; print para("foo",b("bar"),"zbr");
This module takes some ideas from CGI to make easier the life for those who need to generated XML code. You can use the module in three flavours (or combine them):
When importing the module you can specify the tags you will be using:
use XML::Writer::Simple tags => [qw/p b i tt/]; print p("Hey, ",b("you"),"! ", i("Yes ", b("you")));
that will generate
<p>Hey <b>you</b>! <i>Yes <b>you</b></i></p>
You can supply a DTD, that will be analyzed, and the tags used:
use XML::Writer::Simple dtd => "tmx.dtd"; print tu(seg("foo"),seg("bar"));
You can supply an XML (or a reference to a list of XML files). They will be parsed, and the tags used:
use XML::Writer::Simple xml => "foo.xml"; print foo("bar");
This module export one function for each element at the dtd or xml file you are using. See below for details.
Used when you 'use' the module, should not be used directly.
Used to specify a powertag. For instance:
powertag("ul","li"); ul_li([qw/foo bar zbr ugh/]);
will generate
<ul> <li>foo</li> <li>bar</li> <li>zbr</li> <li>ugh</li> </ul>
You can also supply this information when loading the module, with
use XML::Writer::Simple powertags=>["ul_li","ol_li"];
Powertags support three level tags as well:
use XML::Writer::Simple powertags=>["table_tr_td"]; print table_tr_td(['a','b','c'],['d','e','f']);
Alberto Simoes, <ambs@cpan.org>
<ambs@cpan.org>
Please report any bugs or feature requests to bug-xml-writer-simple@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=XML-Writer-Simple. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-xml-writer-simple@rt.cpan.org
Copyright 2006 Alberto Simoes, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install XML::Writer::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XML::Writer::Simple
CPAN shell
perl -MCPAN -e shell install XML::Writer::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.