How do I parse xml with jQuery?

前端 未结 3 1824
太阳男子
太阳男子 2020-12-06 14:08

What is the jQuery alternative to the following JavaScript code?

var xmlobject = (new DOMParser()).parseFromString(xmlstring, \"text/xml\");
<
3条回答
  •  清歌不尽
    2020-12-06 14:45

    var $parsedXml = $(xmlstring);

    For exmaple, if you have something like

    
      
    
    

    as your xmlstring, you could do

    var prop1 = $(xmlstring).find('#prop1').attr('value');

    to get the value of the object property.

提交回复
热议问题