svg/xml being truncated on load?

svg/xml being truncated on load?

am 11.11.2010 01:23:23 von Bill Nelson

Hello,

I am using the CGI.pm module to build a page that includes and embedded
svg image:
print "\n" . Tr(td({-rowspan=>$leaf_count, -height=>"100%",
-width=>"100%"}, " type=\"image/svg+xml\">"), td(\@data));

This generates the expected html:

...

however I get an xml parse error instead of my svg image:
XML Parsing Error: unclosed token
Location: http://localhost/tmp/1247.tree.svg
Line Number 59, Column 3:


and if I paste the source html generated by the program into a file, the
page loads without error.

Does anyone have an idea as to why the xml parse fails when the page is
generated, but not when it's static? (Or am I asking the wrong list?)

Thanks,
Bill

System details:
System Linux orthanc 2.6.16.46-0.12-smp #1 SMP Thu May 17 14:00:09 UTC
2007 x86_64
Apache Version Apache/2.2.3 (Linux/SUSE)
perl v5.8.8
mod_perl v2.0.2-14.2

Re: svg/xml being truncated on load?

am 13.11.2010 19:39:20 von aw

Hi.

Bill Nelson wrote:
> Hello,
>
> I am using the CGI.pm module to build a page that includes and embedded
> svg image:
> print "\n" . Tr(td({-rowspan=>$leaf_count, -height=>"100%",
> -width=>"100%"}, " > type=\"image/svg+xml\">"), td(\@data));
>
> This generates the expected html:
>
> > src="/tmp/5357.tree.svg" width=100% height =100%
> type="image/svg+xml"> ...
>
> however I get an xml parse error

where exactly are you "getting" this error ? in the browser calling up the page ?


instead of my svg image:
> XML Parsing Error: unclosed token
> Location: http://localhost/tmp/1247.tree.svg
> Line Number 59, Column 3:
>
>
> and if I paste the source html generated by the program into a file, the
> page loads without error.
>
> Does anyone have an idea as to why the xml parse fails when the page is
> generated, but not when it's static? (Or am I asking the wrong list?)
>

On the face of it, CGI.pm (and your cgi program) only produce the html page which contains
a *reference* to the svg file. It is the browser which then requests this svg file,
separately, from the server.
The problem you are having, then does not seem to have anything to do with CGI.pm or your
cgi-bin program per se.
Or, does the cgi-bin program also produce the svg file which the browser retrieves ?
In that case, maybe creating this file is not finished by the time the browser requests it ?

Re: svg/xml being truncated on load?

am 13.11.2010 23:31:49 von Bill Nelson

--00163628480adee0190494f6c5af
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi Andr=E9,

You nailed it. My cgi program was creating the svg file and I forgot to
close the file handle. (facepalm)

Thanks for the help.

Bill

On Sat, Nov 13, 2010 at 10:39 AM, Andr=E9 Warnier wrote:

> Hi.
>
>
> Bill Nelson wrote:
>
>> Hello,
>>
>> I am using the CGI.pm module to build a page that includes and embedded
>> svg image:
>> print "\n" . Tr(td({-rowspan=3D>$leaf_count, -height=3D>"100%",
>> -width=3D>"100%"}, " 00%
>> type=3D\"image/svg+xml\">"), td(\@data));
>>
>> This generates the expected html:
>>
>> >> src=3D"/tmp/5357.tree.svg" width=3D100% height =3D100% type=3D"image/svg=
+xml">
>> ...
>>
>> however I get an xml parse error
>>
>
> where exactly are you "getting" this error ? in the browser calling up th=
e
> page ?
>
>
>
> instead of my svg image:
>
>> XML Parsing Error: unclosed token
>> Location: http://localhost/tmp/1247.tree.svg
>> Line Number 59, Column 3:
>> >> ----------------^
>>
>> The line is intact in the svg/xml file:
>>
>> %" />
>>
>> and if I paste the source html generated by the program into a file, the
>> page loads without error.
>>
>> Does anyone have an idea as to why the xml parse fails when the page is
>> generated, but not when it's static? (Or am I asking the wrong list?)
>>
>>
> On the face of it, CGI.pm (and your cgi program) only produce the html pa=
ge
> which contains a *reference* to the svg file. It is the browser which th=
en
> requests this svg file, separately, from the server.
> The problem you are having, then does not seem to have anything to do wit=
h
> CGI.pm or your cgi-bin program per se.
> Or, does the cgi-bin program also produce the svg file which the browser
> retrieves ?
> In that case, maybe creating this file is not finished by the time the
> browser requests it ?
>
>
>

--00163628480adee0190494f6c5af
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi Andr=E9,


You nailed it. My cgi program was creating t=
he svg file and I forgot to close the file handle. (facepalm)
>
Thanks for the help.

Bill

class=3D"gmail_quote">
On Sat, Nov 13, 2010 at 10:39 AM, Andr=E9 Warnier < href=3D"mailto:aw@ice-sa.com">aw@ice-sa.com> wrote:
quote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc=
solid;padding-left:1ex;">
Hi.




Bill Nelson wrote:

x #ccc solid;padding-left:1ex">
Hello,



I am using the CGI.pm module to build a page that includes and embedded svg=
image:

=A0 print "\n" . Tr(td({-rowspan=3D>$leaf_count, -height=3D&g=
t;"100%", -width=3D>"100%"}, "<embed src=3D\=
"$tree_file\" width=3D100% height =3D100% type=3D\"image/svg=
+xml\">"), td(\@data));




This generates the expected html:



<tr><td height=3D"100%" rowspan=3D"23" width=
=3D"100%"><embed src=3D"/tmp/5357.tree.svg" width=
=3D100% height =3D100% type=3D"image/svg+xml"></td> ...<=
br>


however I get an xml parse error




where exactly are you "getting" this error ? in the browser calli=
ng up the page ?






=A0instead of my svg image:

x #ccc solid;padding-left:1ex">
XML Parsing Error: unclosed token

Location: =
http://localhost/tmp/1247.tree.svg


Line Number 59, Column 3:

=A0 =A0 =A0 =A0 =A0 =A0 =A0 <svg:line x1=3D"100.000%" x2=3D&q=
uot;1

----------------^



The line is intact in the svg/xml file:



=A0 =A0<svg:line x1=3D"100.000%" x2=3D"100.000%" y1=
=3D"79.545%" y2=3D"93.182%" />



and if I paste the source html generated by the program into a file, the pa=
ge loads without error.



Does anyone have an idea as to why the xml parse fails when the page is gen=
erated, but not when it's static? (Or am I asking the wrong list?)






On the face of it, CGI.pm (and your cgi program) only produce the html page=
which contains a *reference* to the svg file. =A0It is the browser which t=
hen requests this svg file, separately, from the server.

The problem you are having, then does not seem to have anything to do with =
CGI.pm or your cgi-bin program per se.

Or, does the cgi-bin program also produce the svg file which the browser re=
trieves ?

In that case, maybe creating this file is not finished by the time the brow=
ser requests it ?








--00163628480adee0190494f6c5af--