• jquery 解析 xml


     <?xml version="1.0" encoding="utf-8" ?> <taxrates> <taxrate id="1"> <lower>0</lower> <upper>500</upper> <rate>5</rate> <buckle>0</buckle> </taxrate> <taxrate id="2"> <lower>500</lower> <upper>2000</upper> <rate>10</rate> <buckle>25</buckle> </taxrate> <taxrate id="3"> <lower>2000</lower> <upper>5000</upper> <rate>15</rate> <buckle>125</buckle> </taxrate> <taxrate id="4"> <lower>5000</lower> <upper>20000</upper> <rate>20</rate> <buckle>375</buckle> </taxrate> <taxrate id="5"> <lower>20000</lower> <upper>40000</upper> <rate>25</rate> <buckle>1375</buckle> </taxrate> <taxrate id="6"> <lower>40000</lower> <upper>60000</upper> <rate>30</rate> <buckle>3375</buckle> </taxrate> <taxrate id="7"> <lower>60000</lower> <upper>80000</upper> <rate>35</rate> <buckle>6375</buckle> </taxrate> <taxrate id="8"> <lower>80000</lower> <upper>100000</upper> <rate>40</rate> <buckle>10375</buckle> </taxrate> <taxrate id="9"> <lower>100000</lower> <upper>99999999</upper> <rate>45</rate> <buckle>15375</buckle> </taxrate> </taxrates> [/php] [php] function StandardTaxRate() { $.ajax({ url: "/Resource/salaryTaxRate.xml", dataType: 'xml', type: 'GET', timeout: 2000, error: function(xml) { alert("加载XML 文件出错!"); }, success: function(xml) { $(xml).find("taxrate").each(function(i) { var oid = $(this).attr("id"); var lower = $(this).children("lower").text(); var upper = $(this).children("upper").text(); var rate = $(this).children("rate").text(); var buckle = $(this).children("buckle").text(); ///后续操作。。。 }); } }); }

    [php] <?xml version="1.0" encoding="utf-8" ?> <taxrates> <taxrate id="1"> <lower>0</lower> <upper>500</upper> <rate>5</rate> <buckle>0</buckle> </taxrate> <taxrate id="2"> <lower>500</lower> <upper>2000</upper> <rate>10</rate> <buckle>25</buckle> </taxrate> <taxrate id="3"> <lower>2000</lower> <upper>5000</upper> <rate>15</rate> <buckle>125</buckle> </taxrate> <taxrate id="4"> <lower>5000</lower> <upper>20000</upper> <rate>20</rate> <buckle>375</buckle> </taxrate> <taxrate id="5"> <lower>20000</lower> <upper>40000</upper> <rate>25</rate> <buckle>1375</buckle> </taxrate> <taxrate id="6"> <lower>40000</lower> <upper>60000</upper> <rate>30</rate> <buckle>3375</buckle> </taxrate> <taxrate id="7"> <lower>60000</lower> <upper>80000</upper> <rate>35</rate> <buckle>6375</buckle> </taxrate> <taxrate id="8"> <lower>80000</lower> <upper>100000</upper> <rate>40</rate> <buckle>10375</buckle> </taxrate> <taxrate id="9"> <lower>100000</lower> <upper>99999999</upper> <rate>45</rate> <buckle>15375</buckle> </taxrate> </taxrates> [/php] [php] function StandardTaxRate() { $.ajax({ url: "/Resource/salaryTaxRate.xml", dataType: 'xml', type: 'GET', timeout: 2000, error: function(xml) { alert("加载XML 文件出错!"); }, success: function(xml) { $(xml).find("taxrate").each(function(i) { var oid = $(this).attr("id"); var lower = $(this).children("lower").text(); var upper = $(this).children("upper").text(); var rate = $(this).children("rate").text(); var buckle = $(this).children("buckle").text(); ///后续操作。。。 }); } }); } [/php]

  • 相关阅读:
    SAS数据集推送到sql server 数据库 实现代码段
    windows server 2008通过任务计划程序定时访问网站
    把SAS批提交添加到鼠标右键
    SAS 报表输出一些新式控制
    iis ajax post 跨域问题解决
    sas infile 控制导入长度
    SAS infile 导入txt示例
    sas 批量处理缺少缺失值
    vue $router $route
    jsonp使用post方法
  • 原文地址:https://www.cnblogs.com/freefei/p/3234969.html
Copyright © 2020-2023  润新知