jQuery 获取xml数据在IE中无效的问题
前段时间用jQuery做了个小练习,获取本地的xml数据,在firefox下面测试没问题,但是在IE下面总是获取数据失败,上网找了很久也没找到是怎么回事。郁闷了很长一段时间,今天有空又把这个问题拿出来研究了下,最后终于找到原因了,把页面放到服务器去浏览就OK了。难道是权限问题?不知道怎么火狐在本地目录可以获取数据成功。对于操作xml文档要放到服务器去,要不然会没有权限。
//html
<h1>加载xml数据</h1>
<input type="button" value="加载xml数据" id="loadXml"/>
<div class="xmldata">这里显示XML数据</div>
//js
$(function(){
$("#loadXml").click(function(){
$.ajax({
type:'get',
url:'xml.xml',
dataType:"xml",
success:function(data){
$(".xmldata").empty();
$("user",data).each(function(){
var users=$(this);
var html='<div class="name">';
html+=users.find("name").text();
html+='</div>';
html+='<div class="age">';
html+=users.find("age").text();
html+='</div>';
html+='<div class="sex">';
html+=users.find("sex").text();
html+='</div>';
$(".xmldata").append($(html));
})
}
})
})
})
//xml
<?xml version="1.0" encoding="gb2312"?>
<userInfo>
<user>
<name>haohao</name>
<age>18</age>
<sex>man</sex>
</user>
<user>
<name>do
相关文档:
Parsing XML from the Net - Using the SAXParser
http://www.anddev.org/parsing_xml_from_the_net_-_using_the_saxparser-t353.html
What you learn:
You will learn how to properly parse XML
(here: from the net
) using a SAXParser
.
What it will look like:
Description:
0.)
In this tutorial we ......
public partial class Form1 : Form
{
DataSet ds = new DataSet();
public Form1()
{
......
FusionCharts 的 XML标签属性有一下四种数据类型
* Boolean - 布尔类型,只能为1或者0。例如:<graph showNames=’1′ >
* Number - 数字类型,只能为数字。例如:<graph yAxisMaxValue=’200′ >
* String - 字符串类型,只能为字符串。例如: <graph caption=’My Chart&rsqu ......
//******************** 头文件 Markup.h *******************
// Markup.h: interface for the CMarkup class.
//
// Markup Release 11.2
// Copyright (C) 2009 First Objective Software, Inc. All rights reserved
// Go to www.firstobject.com for the latest CMarkup and EDOM documentation
// ......