OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Trying to use the DOMParser with node js

  • Thread starter Thread starter Stephen D
  • Start date Start date
S

Stephen D

Guest
I am running into issues when trying to use the DOMParser in my js code. In my code, I retrieve an xml file via xmlhttp.responseText soap response. I want to be able to access its elements in JSON format, so my code looks like:

Code:
var xml = new DOMParser();
xml = xml.parseFromString(xmlhttp.responseText, 'text/xml');
var result = xmlToJson(xml);

I get this error message: ReferenceError: DOMParser is not defined

Edit: This link hasn't worked for me because my javascript isn't in the HTML page, as it is a node.js file. JavaScript DOMParser access innerHTML and other properties

<p>I am running into issues when trying to use the DOMParser in my js code. In my code, I retrieve an xml file via xmlhttp.responseText soap response. I want to be able to access its elements in JSON format, so my code looks like:</p>
<pre class="lang-js prettyprint-override"><code>var xml = new DOMParser();
xml = xml.parseFromString(xmlhttp.responseText, 'text/xml');
var result = xmlToJson(xml);
</code></pre>
<p>I get this error message:
ReferenceError: DOMParser is not defined</p>
<p>Edit:
This link hasn't worked for me because my javascript isn't in the HTML page, as it is a node.js file. <a href="https://stackoverflow.com/questions...mparser-access-innerhtml-and-other-properties">JavaScript DOMParser access innerHTML and other properties</a></p>
 
Top