ÓÃ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);
}
})
});
});
Ïà¹ØÎĵµ£º
Ô´xmlÎļþ
<?xml version="1.0" encoding="iso-8859-1"?>
<books>
<stock>
<name>The Picasso Code</name>
<author>Dan Blue</author>
<category>Fiction</category>
<description>Cubist paintings reveal a secret society of people ......
ºÍ & & amp;
µ¥
ÒýºÅ ' & apos;
Ë«Òý
ºÅ "   ......
DOMÊÇ»ùÓÚÆ½Ì¨¡¢ÓïÑÔÎ޹صĹٷ½W3C±ê×¼¡£»ùÓÚÊ÷µÄ²ã´Î£¬ÆäÓŵãÊÇ¿ÉÒÔÒÆÖ²£¬±à³ÌÈÝÒ×£¬¿ª·¢ÈËÔ±Ö»ÐèÒªµ÷Óý¨Ê÷µÄÖ¸Áî¡£ÆäȱµãÊǼÓÔØ´óÎļþ²»ÀíÏë¡£
¡¡¡¡SAXÊÇ»ùÓÚʼþÄ£Ð͵ģ¬ËüÔÚ½âÎö XML ÎĵµµÄʱºò¿ÉÒÔ´¥·¢Ò»ÏµÁеÄʼþ£¬µ±·¢ÏÖ¸ø¶¨µÄtagµÄʱºò£¬Ëü¿ÉÒÔ¼¤»îÒ»¸ö»Øµ÷·½·¨£¬¸æË߸÷½·¨Öƶ¨µÄ±êÇ©ÒѾÕÒµ½¡£ÀàËÆÓëÁ÷ýÌåµÄ½ ......
//pugxml.h
///////////////////////////////////////////////////////////////////////////////
//
// Pug XML Parser - Version 1.0002
// --------------------------------------------------------
// Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
// Released into the Public Domain. Use at yo ......
If XML data in the table is less than 32K for each record, then you can directly unload the data as char. If XML data exceeds 32K for some records, then you have to unload the common data and the XML data separately. First, create a template for unloading XML into a PDS: TEMPLATE LOBFRV DSN 'AAA. ......