Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Perl to rewrite simple SVG

by Anonymous Monk
on Sep 04, 2013 at 05:03 UTC ( #1052211=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I've got a really simple SVG that consists of solid, colored boxes. Each box in the SVG is represented with a line like the following:

<rect x="36" y="36" fill="#0000FF" width="392.4" height="43.2"/>

I need to modify the file so that each of these boxes is replaced with an element that points to another SVG, as in the following:

<image overflow="visible" width="392.4" height="43.2" xlink:href="0000FF.svg" transform="matrix(1 0 0 1 36 36)"></image>

What is the best way to do this? The initial SVG serves as a sort of template that directs the layout of a more complicated image. Each colored box is a stand in that shows where to place another SVG that is generated programatically.

Comment on Perl to rewrite simple SVG
Re: Perl to rewrite simple SVG
by kejohm (Hermit) on Sep 04, 2013 at 05:49 UTC
    Since SVGs are XML-based, you could use one of Perl's XML parsing modules, for instance XML::Twig or XML::Simple.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1052211]
Approved by hdb
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (14)
As of 2014-07-30 17:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (237 votes), past polls