in reply to A data structure for XML generation

Over the weekend I used Carl Mäsak's SVG module (Perl 6), which -- despite its name -- is general XML serializer.

It uses Pair objects for both attributes and child tags, distinguished by the type of the value: if the value is an List, it's used as a child tag, if it's a scalar it's used as an attribute.

The documentation uses this example:

my $svg = :svg[ # root tag :width(200), # attribute :height(200), # circle => [ # child tag :cx(100), :cy(100), :r(50) # child tag attributes ], text => [ # child tag :x(10), :y(20), "hello" # child tag attributes ] ];

I used this data structure to generate bar charts in SVG, and found it very handy.