var overtime='<?xml version="1.0" encoding="UTF-8"?><response><code><liuhao>5555555</liuhao><age>555555555</age></code> <message>success</message> <totalCount>5000000</totalCount> <remainCount>4999883</remainCount> <DonateCount>12</DonateCount> <Limit>80088800</Limit></response>';
    function  parseXMLsimple(target){
        var reg=/<([a-z,A-Z]+)>(.+)<\/\1>/g;
        var obj={};
        target.replace(reg,function(a,b,c){
            obj[b]=reg.test(c)?parseXMLsimple(c):c;
        })
        return obj;
    }
    console.log(parseXMLsimple(overtime))

  

相关文章:

  • 2021-05-22
  • 2022-01-31
  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-20
  • 2022-01-13
  • 2022-12-23
  • 2021-07-14
相关资源
相似解决方案