javascript - How can I download a XML #document generated by DOMparser? -


good morning.

i have webpage form generates xml document domparser(). that's function xml:

function texttoxml(text) {     try {         var xml = null;          if (window.domparser) {             var parser = new domparser();             xml = parser.parsefromstring(text, "application/xml");             var found = xml.getelementsbytagname("parsererror");             if (!found || !found.length || !found[0].childnodes.length) {                 return xml;             }             return null;         } else {             xml = new activexobject("microsoft.xmldom");             xml.async = false;             xml.loadxml(text);             return xml;         }     } catch (e) {         // suppress     } } 

and xml document (displayed on console.log()): xml document obtained (pixelated don't show data)

and don't know how download now, have tried with

location.href='data:application/download,' + encodeuricomponent(xmlfile) 

but downloaded file show "[object] object".

i got it. searching plugin , got https://github.com/eligrey/filesaver.js !! hope more me! try me!


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -