Skip Menu |

This queue is for tickets about the SVG CPAN distribution.

Report information
The Basics
Id: 50075
Status: resolved
Priority: 0/
Queue: SVG

People
Owner: Nobody in particular
Requestors: mmcgillis [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.44
Fixed in: (no value)



Subject: SVG inline code generation includes <?xml...?> line
Show quoted text
>Try option -inline on method xmlify:
The code sample I provided uses it and that removes some information but the <?xml..?> line still is printed. Show quoted text
>If it fails, a trick you can use is to use a 2nd SVG constructor within your document and >xmlify that one rather than the whole document, dropping all xml declarations and >annotations: > >my $doc = SVG->new(); >my $svg = $doc->svg(); >... >$svg->xlify(); #renders the inner svg snippet. > >Let me know where you are, and please submit an RT bug report if the inline function fails >to do what you expect it to.
The above approach doesn't seem to generate proper svg information for browsers to render it correctly I only get: <svg height="100%" width="100%"> where we seem to need something more like <svg height="600" width="600" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> So I'm still not seeing a workable option using the code as is. I would be happy to generate an RT if I had a URL of where to enter it. The only thing I found definitive to get information to the developers of this project was this e-mail address. Matthew On Sep 27, 2009, at 8:17 PM, <ronan.oger@roitsystems.com> wrote: Hi Matthew, Try option -inline on method xmlify: $svg->xmlify(-inline) It's described in SVG::Manual. Also take a look at the installation test 04-inline.t http://cpansearch.perl.org/src/RONAN/SVG-2.49/t/04-inline.t Unfortunately I'm nowhere near a machine where I can verify that the snippet actually works. If it fails, a trick you can use is to use a 2nd SVG constructor within your document and xmlify that one rather than the whole document, dropping all xml declarations and annotations: my $doc = SVG->new(); my $svg = $doc->svg(); ... $svg->xlify(); #renders the inner svg snippet. Let me know where you are, and please submit an RT bug report if the inline function fails to do what you expect it to. Thanks for the ping, Ronan From: Matthew McGillis <matthew@mcgillis.org> Date: 9/28/09 2:03Subject: SVG I was looking at using your SVG module for generating some web content. Using something like: #!/usr/bin/perl use CGI; use SVG; my $cgi=CGI->new(); my $svg=SVG->new(width=>200,height=>200); my $y=$svg->group(id=>'group_y',style=>{stroke=>'red',fill=>'green'}); $y->circle(cx=>100,cy=>100,r=>50,id=>'circle_in_group_y'); print $cgi->header("application/xhtml+xml"); print qq|<?xml version="1.0" encoding="UTF-8"?>\n|; print qq|<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg- flat.dtd ">\n|; print qq|<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\n|; print "<head>\n"; print "<title>Test</title>\n"; print "</head>\n"; print "<body>\n"; print $svg->xmlify(-inline => 1); print "</body>\n"; print "</html>\n"; Unfortunately the above generates: Content-Type: application/xhtml+xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd "> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Test</title> </head> <body> <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <svg height="200" width="200" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink "> <g id="group_y" style="fill: green; stroke: red"> <circle cx="100" cy="100" id="circle_in_group_y" r="50" /> </g><!-- Generated using the Perl SVG Module V2.44 by Ronan Oger Info: http://www.roitsystems.com/ --> </svg></body> </html> Which is very close to workable however svg generates an extra <? xml ...?> line causing the above xhtml to be invalid. I did some digging into your code and could not find any hooks to prevent that line from getting generated for this sort of situation. If I have missed something please let me know. If not this would be useful functionality for this sort of coding. Thanks, Matthew
Thanks Matthew, this is fixed in version 2.50. Florent