Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: A data structure for XML generation

by moritz (Cardinal)
on Aug 17, 2009 at 06:50 UTC ( [id://789091]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://789091]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2024-04-23 17:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found