0

I have a line in my javascript code that looks as this:

var xml = '<xml><block type="factory_base" deletable="false" movable="false"></block></xml>';

How could I do the same thing but if what I have is a XML file? How can I have the content of that XML file as a string in order to have a variable that is this string? I've looked through umpteen forums and possibilities but didn't success.

Thanks in advance!

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • Are you talking about JavaScript running in a browser? Is the XML file a file on the user's hard disk or a resource that a URL points to? Are you talking about JavaScript running in Node.js? Again, file or URL? Is there JS running somewhere other than that? – Quentin Aug 14 '20 at 16:08
  • @Quentin it is javascript running in a browser and the XML file would be in the hard disk – Rafa Menendez de la Vega Aug 14 '20 at 16:13

0 Answers0