in reply to Re^2: Printing element without nested children in XML::Twig
in thread Printing element without nested children in XML::Twig

Okay, I think I understand.
I think the best solution is to add a "button" element as the first child of each element of the tree you want to display with a button.
When printing, the first element to be displayed after your 'element' will be its button, and then the other childs.

And yes, my 'solution' was bad and would have sensibly slow down the page.

For your error, you are probably trying to add the same 'reference', meaning you don't create a new element before adding it, you only 'edit' the old one properties and try to add it again, but i'm not used to XML::Twig and I didn't see your code.
  • Comment on Re^3: Printing element without nested children in XML::Twig