XML::Writer::Lazy - Pass stringified XML to XML::Writer
Pass stringified XML to XML::Writer
my $writer = XML::Writer::Lazy->new( OUTPUT => 'self'); my $title = "My Title!"; $writer->lazily(<<"XML"); <html> <head> <title>$title</title> </head> <body> <p>Pipe in literal XML</p> XML $writer->startTag( "p", "class" => "simple" ); $writer->characters("Alongside the usual interface"); $writer->characters("123456789"); $writer->lazily("</p></body></html>");
This is 2016. The computer should do the hard work. Life's too short to write a bunch of
endTag when my computer's perfectly capable of figuring out the right thing to do if I give it a chunk of XML.
Using a SAX parser whose events are then passed back to XML::Writer.
This is a subclass of XML::Writer.
new() and then instantiates the lazy parser pieces. Accepts all the same arguments as the parent method.
Take a string of XML. It should be parseable, although doesn't need to be balanced.
<foo><bar>asdf is fine, where
<foo is not. Exercises the XML::Writer methods appropriately to re-create whatever you'd passed in.
Only important if you're doing strange things with the
OUTPUT after instantiation. In order to keep track of what's been written already, this class wraps the
OUTPUT object inside a delegate that intercepts and stores the contents of
Peter Sergeant -
MIT - see the
LICENSE file included in the tar.gz of this distribution.