Table in SVG file

0

I create an SVG file in PHP. I wanted to write a table in the file so I could show it later. I used this, but it does not show the table when I open it 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);
    
asked by anonymous 26.12.2014 / 13:08

1 answer

0

You need to tell the XML namespace you want to import using the requiredExtensions attribute of the foreignobject tag, 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>
    
26.12.2014 / 14:37