Say that one single DOM or Document element (like window.document) is passed to you in JavaScript, how would you turn this into valid XML?
In particular, for my example, I have a webpage with SVG mapping, this SVG has a lot of JavaScript to let you interact. This is a graphical display that allows you to scale the graph and even make some conversions. Now users with this want to have a "Save Image" button. I suppose that this is done to take the node document for the SVG element and convert it to XML, and then send it to the server, which then returns the page with the SVG document or PNG image.
This all works on FireFox (which is currently a requirement for users, although it works great in both Safari and Chrome). In firefox on a webpage, I included the SVG document as an Object element. In javascript, I can access these contentDocument objects, which refers to the root of the XML page. It contains an XML version, a Document tag, and a svg root tag with all attributes.
Perhaps someone has already decided this, so I can copy their code. Perhaps someone knows where to look in firebug to achieve this. Or perhaps there are DOM methods for this.
source
share