HTML5 canvas to XML and vice versa
Just started to using HTML5 canvas. I had drawn a diagram and I want to save the diagram as XML file not as image file. so that i can import it later. Is there any plug-ins available to do that. please advice how can i achieve 开发者_C百科canvas to XML.
You haven't specified what XML format you want to export the drawing to.
But my advice would be to do the drawing using SVG instead of Canvas. SVG is already an XML format, so you wouldn't need to do any converting to XML.
It's possible that something like canvg might do what you require. This is a Javascript library that parses an SVG file and renders it to a canvas
instance.
(I'm assuming SVG is what you want; that would be the logical choice).
精彩评论