XML::XMLWriter

XML::XMLWriter is a Perl module for creating a XML document object oriented with on the fly validating towards the given DTD.
Download

XML::XMLWriter Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • XML::XMLWriter Team
  • Publisher web site:
  • http://search.cpan.org/~morni/XML-XMLWriter-0.1/XMLWriter.pm

XML::XMLWriter Tags


XML::XMLWriter Description

XML::XMLWriter is a Perl module for creating a XML document object oriented with on the fly validating towards the given DTD. XML::XMLWriter is a Perl module for creating a XML document object oriented with on the fly validating towards the given DTD.Example Code #!/usr/bin/perl use XML::XMLWriter; my @data=(, , , , ); my $doc = new XML::XMLWriter(system => 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd', public => '-//W3C//DTD XHTML 1.0 Transitional//EN'); my $html = $doc->createRoot; $html->head->title->_pcdata('A Table'); my $body = $html->body; $body->h1->_pcdata('Here is a table!'); my $table = $body->table({align => 'center', cellspacing => 1, cellpadding => 2, border => 1}); for(my $i=0; $itr; foreach $_ (@{$data}) { $i==0 ? $tr->th->_pcdata($_) : $tr->td->_pcdata($_); } } $body->b->_pcdata("that's it!"); $doc->print();XMLWriter is a Perl 5 object class, its purpose is to make writing XML documents easier, cleaner, safer and standard conform. Its easier because of the object oriented way XML documents are written with XMLWriter. Its cleaner because of the simple but logical API and its safe and standard conform because of the automatically done checking against the the DTD.But still: it might be a matter of taste whether one finds XMLWriter usefull or not and it probably has some bugs (i would appreciate a lot if you report them to me), many usefull features are missing, not implemented or not even thought of and perhaps the API with all its simpleness might be confusing though. So please tell me your opinion and tell me the way how you would make XMLWriter better. Its not so easy to develop a good API for this matter.XMLWriter contains 3 packages: XMLWriter.pm which gives you the document object, Element.pm which provides the element/tag objects and PCData.pm which represents the parsed character data the document contains. There'll probably come more objects in feature releases. The most interesting class is Element.pm. It provides some methods you can call on every document element, but besides those methods it uses the AUTOLOAD feature of perl to expect every not known method name to be the name of a tag that should be added to the list of child tags of the element the method is called on. So calling $html->head will simply add a new element (the head element) to the list of child tags of the html element. The head object is returned. Have a look at the examples for better understanding. You should also read the POD of Element.pm and PCdata.pm.Requirements:· Perl Requirements: · Perl


XML::XMLWriter Related Software