易截截图软件、单文件、免安装、纯绿色、仅160KB

用jquery解析xml文件

测试用的xml文件
<?xml version="1.0" encoding="UTF-8"?>
<schools>
<school id='111'>测试学校</school>
<school id='222'>测试学校22
<class id='2.1'>测试班级222</class>
</school>
</schools> 
测试用的JavaScript代码
$().ready(function(){
$.post("/index_school/test_data.xml",function(data){
//解析xml文件中的信息
$(data).find('school').each(function(){
var $school = $(this);
//获取属性
var schoolId = $school.attr("id");
//获取标签中的文本
var schoolText = $school.text();
//获取子元素的属性和文本
/*
$school.find('class').each(function(){
var $schoolClass = $(this);
alert( $schoolClass.attr("id") + "--" +$schoolClass.text() );
})*/
//如果没有,则在使用之前要进行判断
var classId = $school.children('class').attr("id");
if(classId!=null){
alert(classId);
}
})
});
}); 


相关文档:

VC解析XML 使用CMarkup类解析XML

VC解析XML--使用CMarkup类解析XML
(一) 先讲一下XML中的物殊字符,手动填写时注意一下。
字符                   字符实体
&              &nb ......

在form 窗体 利用xml和xsl来实现表的嵌套

先创建数据然后生成相应的xml文件
 DataSet ds = new DataSet();
            #region Parent Table
            DataTable dt1 = new DataTable("Parent");
     ......

XML 中,有 5 个预定义的实体引用:


&lt;
<
小于
&gt;
>
大于
&amp;
&
和号
&apos;
'
单引号
&quot;
"
引号
 
注释:在 XML 中,只有字符 "<" 和 "&" 确实是非法的。大于号是合法的,但是用实体引用来代替它是一个好习惯。 ......

Whitespace is not allowed before an XML Processing

转:http://hi.baidu.com/oneshotonekill/blog/item/be68b513f7c929d7f6039e1e.html
Whitespace is not allowed before an XML Processing Instruction (< ? ... ?>). HTMLComponent.Eclipse在编辑mxml的时候提示这样的错误。检查才发现代码中在<? ?>之前存在空格。 ......

XML ,query 和 value是区分大小写 的

DECLARE @x xml
SET @x='
<root>
  <ShopAccount>
    <ActivityType>IA - PM Standing WO (for LPI report)</ActivityType>
    <ProjectNo>R</ProjectNo>
  </ShopAccount>
  <ShopAccount>
    ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号