<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>jQuery XML to JSON Plugin v1.0 (2008-07-03)</title>
<!--// documentation resources //-->
<script src='jquery.js' type="text/javascript"></script>
<script src='documentation.js' type="text/javascript"></script>
<link href='documentation.css' type="text/css" rel="stylesheet"/>
<!--// code-highlighting //-->
<script type="text/javaScript" src="/jquery/project/chili/jquery.chili-2.0.js"></script>
<!--///jquery/project/chili-toolbar/jquery.chili-toolbar.pack.js//-->
<script type="text/javascript">try{ChiliBook.recipeFolder="/jquery/project/chili/"}catch(e){}</script>
<!--// plugin-specific resources //-->
<script src='jquery.xml2json.js' type="text/javascript" language="javascript"></script>
<script src="testing.js" type="text/javascript" language="javascript"></script>
<style type="text/css">
.test-result{ font-size:97%; background:#f7f7f7; padding:3px 10px; border:#ccc solid 3px; height:250px; overflow:auto; }
.test-result ul{ margin:0 0 0 15px; }
</style>
</head>
<body>
<a name="top"></a>
<div id="wrap">
<div id="roof">
<a href="http://www.fyneworks.com/jquery/"><strong>jQuery Plugins</strong></a>:
<a href="http://www.fyneworks.com/jquery/multiple-file-upload/">Multiple File Upload</a>,
<a href="http://www.fyneworks.com/jquery/star-rating/">Star Rating</a>,
<strong>NEW:</strong>
<a href="http://www.fyneworks.com/jquery/FCKEditor/">CKEditor</a>
(old: <a href="http://www.fyneworks.com/jquery/FCKEditor/">FCKEditor</a>),
<a href="http://www.fyneworks.com/jquery/Codepress/">Codepress</a>,
<a href="http://www.fyneworks.com/jquery/xml-to-json/">XML to JSON</a>
<span style="position:absolute; right:0;">
<script type="text/javascript">digg_title='jQuery XML to JSON Plugin';</script>
<script type="text/javascript">digg_url='http://www.fyneworks.com/jquery/xml-to-json/';</script>
<script type="text/javascript">digg_bgcolor='#e7e7e7';digg_skin='compact';digg_window='new';</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
</span>
</div>
<div id="head">
<table width="100%" cellspacing="5">
<tr>
<td valign="middle">
<h1>jQuery XML to JSON Plugin</h1>
<span style="cursor:help; background:#C00; padding:2px; color:#FFF;" title="Current Version">
v<strong>1.0</strong>
</span>
</td>
<td valign="middle" width="450" align="right">
<div id="search" style="display:none">
<form action="http://www.google.com/cse" id="cse-search-box" target="_blank">
<label for="q">Find another jQuery plugin:</label>
<input type="hidden" name="cx" value="partner-pub-9465008056978568:j3ebzr-v1o0" />
<input type="hidden" name="ie" value="ISO-8859-1" />
<input type="text" name="q" id="q" size="20" />
<input type="submit" name="sa" value="Search" />
</form>
<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script>
</div>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="6856904">
<input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
</td>
</tr>
</table>
</div>
<div class="hint">
<span style="float:right">
See also: <a href="http://plugins.jquery.com/project/xmlObjectifier/">xmlObjectifier</a>
</span>
<strong>Hint</strong>:
use <a href="http://www.getfirefox.com/" target="_blank">Firefox</a>
with <a href="http://getfirebug.com/" target="_blank">Firebug</a> to
really see what's going on.
</div>
<div id="body">
<div id="ad"><a href="http://www.pinesandneedles.com/" target="_blank"><img src="http://www.pinesandneedles.com/U/fyneworks-ad.png" width="120" height="200" alt="FREE mistletoe with your Christmas tree" style="margin:0 0 40px 0;"/></a>
<!--//
<div id='vu_ytplayer_vjVQa1PpcFNzWL_xJNUOpZhjtZP7PE8aGHuLQqHHrFI='><a href='http://www.youtube.com/browse'>Watch the latest videos on YouTube.com</a></div>
<script type='text/javascript' src='http://www.youtube.com/watch_custom_player?id=vjVQa1PpcFNzWL_xJNUOpZhjtZP7PE8aGHuLQqHHrFI='></script>
//-->
<script type="text/javascript"><!--
google_ad_client = "pub-9465008056978568";
/* 120x600, created 25/11/09 */
google_ad_slot = "4176621808";
google_ad_width = 120;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<div id="documentation" class="tabs">
<ul class="Clear">
<li><a href="#tab-Overview" id="btn-Overview">Overview</a></li>
<li><a href="#tab-Usage" id="btn-Usage">Usage</a></li>
<li><a href="#tab-Examples" id="btn-Examples">Examples</a></li>
<li><a href="#tab-Download" id="btn-Download">Download</a></li>
<li><a href="#tab-Support" id="btn-Support">Support</a></li>
<li><a href="#tab-License" id="btn-License">License</a></li>
</ul><!--// tabs //-->
<!--//
####################################
#
# * START CONTENT *
#
####################################
//-->
<div id="tab-Overview">
<h2>What is this?</h2>
<p>
The <strong>XML to JSON Plugin</strong> (<em>jQuery.xml2json</em>)
is a script you can use to convert simple XML into a JSON object.
</p>
<table width="100%">
<tr>
<td valign="top" width="50%">
<h3>Convert this...</h3>
<pre class="code"><code class="html"><xml>
<message>Hello world</message>
</xml></code></pre>
</td>
<td valign="top" width="50%">
<h3>...into this:</h3>
<pre class="code"><code class="js">{
message: 'Hello world';
}</code></pre>
</td>
</tr>
</table>
<h2>How does it work?</h2>
<table width="100%">
<tr>
<td valign="top" width="50%">
<h3>With XML in a string</h3>
<a href="javascript:;" onClick="eval($(this).next().text())">Click here to test this code</a>
<pre class="code"><code class="js">var xml = '<xml><message>Hello world</message></xml>';
var json = $.xml2json(xml);
alert(json.message);</code></pre>
</td>
<td valign="top" width="50%">
<h3>With XML loaded via Ajax</h3>
<a href="javascript:;" onClick="eval($(this).next().text())">Click here to test this code</a>
<pre class="code"><code class="js">$.get('data/hello.xml', function(xml){
var json = $.xml2json(xml);
alert(json.message);
});</code></pre>
</td>
</tr>
</table>
<h2>Why convert XML to JSON?</h2>
<p>
Those of you with a little more jQuery experience will know that
in simple cases (such as the above) we could use jQuery DOM traversing
functionality to achieve the same result without the need of a plugin:
</p>
<pre class="code"><code class="js"
>alert($('<xml><message>Hello world</message></xml>').find('message').text());</code></pre>
<div style="color:#006600">
<strong>Hint</strong>: you do not need this plugin if that's as complex as your XML will get.
</div>
<p>
<strong>However</strong>, jQuery's DOM traversing can soon become a little tiring
if...<br/>
A. you frequenly process XML responses from Ajax calls<br/>
B. you parse com
没有合适的资源?快使用搜索试试~ 我知道了~
xml-to-json
共34个文件
svn-base:14个
xml:7个
js:6个
3星 · 超过75%的资源 需积分: 10 25 下载量 48 浏览量
2010-10-19
10:17:13
上传
评论 1
收藏 100KB ZIP 举报
温馨提示
把XML转换成JSON格式的一个jQuery 扩展类,非常好用,JSON被各种浏览器支持
资源推荐
资源详情
资源评论
收起资源包目录
xml-to-json.zip (34个子文件)
documentation.html 25KB
jquery.xml2json.js 6KB
documentation.js 15KB
testing.js 3KB
documentation.css 5KB
jquery.xml2json.pack.js 2KB
jquery-1.31.js 119KB
jquery.js 122KB
index.html 500B
data
notes.xml 375B
menu.xml 1KB
.svn
props
all-wcprops 680B
entries 1KB
text-base
catalog.xml.svn-base 5KB
hello.xml.svn-base 41B
simple.xml.svn-base 254B
menu.xml.svn-base 1KB
animals.xml.svn-base 264B
rss.xml.svn-base 4KB
notes.xml.svn-base 375B
format 2B
tmp
props
text-base
prop-base
prop-base
catalog.xml.svn-base 36B
hello.xml.svn-base 36B
simple.xml.svn-base 36B
menu.xml.svn-base 36B
animals.xml.svn-base 36B
rss.xml.svn-base 36B
notes.xml.svn-base 36B
simple.xml 254B
animals.xml 264B
rss.xml 4KB
catalog.xml 5KB
hello.xml 41B
index.asp 45B
共 34 条
- 1
资源评论
- wangxianyun_09122013-11-27多层嵌套不可以解析
ben20000
- 粉丝: 4
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功