Trying to use the DOMParser with node js

前端 未结 7 1444
忘了有多久
忘了有多久 2020-12-01 10:17

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 ac

7条回答
  •  旧时难觅i
    2020-12-01 10:36

    You can use a Node implementation of DOMParser, such as xmldom. This will allow you to access DOMParser outside of the browser. For example:

    var DOMParser = require('xmldom').DOMParser;
    var parser = new DOMParser();
    var document = parser.parseFromString('Your XML String', 'text/xml');
    

提交回复
热议问题