Table in SVG file

Asked

Viewed 55 times

0

I create a SVG file in PHP. I wanted to write a table in the file, and then show it. I used this, but it doesn’t show the table when I open with an editing program.

fwrite($hndl, "<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n");
fwrite($hndl, "<svg width='297mm' height='210mm' xmlns='http://www.w3.org/2000/svg'>\n");
fwrite($hndl, "<foreignobject x='10' y='10' width='100%' height='150'><body xmlns='http://www.w3.org/1999/xhtml'> ");
fwrite($hndl, "<table><tr><td>".$datelog."</td><td>".$nomcourbe."</td></tr><tr><td>".$login."</td><td>Pilotor</td></tr></table>\n");
fwrite($hndl, "</body></foreignobject>");
fwrite($hndl, "</svg>\n");                                                                              
fclose($hndl);

1 answer

0


You need to inform the XML namespace you want to import using the attribute requiredExtensions tag foreignobject, and not just the first tag of that specific XML:

<foreignobject x='10' y='10' width='100%' height='150' requiredExtensions='http://www.w3.org/1999/xhtml'>
    <body xmlns='http://www.w3.org/1999/xhtml'></body>
</foreignobject>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.