富贵资源网 Design By www.hznty.com

本文实例讲述了jQuery读取XML文件的方法。分享给大家供大家参考,具体如下:

<"1.0" encoding="utf-8" "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>
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();
        ///后续操作。。。
      });
    }
  });
}

PS:这里再为大家提供几款关于xml操作相关在线工具供大家参考使用:

在线XML/JSON互相转换工具:
http://tools.jb51.net/code/xmljson

在线格式化XML/在线压缩XML:
http://tools.jb51.net/code/xmlformat

XML在线压缩/格式化工具:
http://tools.jb51.net/code/xml_format_compress

xml代码在线格式化美化工具:
http://tools.jb51.net/code/xmlcodeformat

更多关于jQuery相关内容感兴趣的读者可查看本站专题:《jQuery操作xml技巧总结》、《jQuery操作json数据技巧汇总》、《jQuery扩展技巧总结》、《jQuery常用插件及用法总结》、《jQuery常见经典特效汇总》及《jquery选择器用法总结》

希望本文所述对大家jQuery程序设计有所帮助。

富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com

P70系列延期,华为新旗舰将在下月发布

3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。

而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?

根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。