I've been messing around with XML::Twig the last couple days and have found it to be extremely useful for parsing huge xml documents, yet still keeping an easy interface to the data record. Bravo!
Since my code was mostly using Twig for XML input parsing, I decided that in my actual output XML generation, I'd give it a try as well. Not sure if it entirely makes much sense to do it like that, and perhaps it'll slow down performance... But I don't know, since I can't get it to work.
I've looked through all the online help documentation, and my guess stab at doing something like this would be like this:
my $out = new XML::Twig();
my $tag = "tag1";
my $text = "this is some text";
my $elt = XML::Twig::Elt->new($tag, $text);
...some how attach the element to the twig..
$out->flush;
I think I'm getting a little lost in the details. All the code I've seen for "pasting" elements apply to twigs that were generated using a parse on an existing document. I wanted to just completely create a new xml structure not at all similiar to the input XML. I'm probably trying to use the wrong tool for such a thing and should just use XML::Simple. I just like the thought of using the same package for everything. Any helpful example code?