<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Design-Notes &#187; XML</title>
	<atom:link href="http://design-notes.info/tag/xml/feed/" rel="self" type="application/rss+xml" />
	<link>http://design-notes.info</link>
	<description>Design-Notes</description>
	<lastBuildDate>Wed, 23 Jun 2010 16:08:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using jQuery to Parse XML data</title>
		<link>http://design-notes.info/tutorial/using-jquery-to-parse-xml-data/</link>
		<comments>http://design-notes.info/tutorial/using-jquery-to-parse-xml-data/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 20:53:48 +0000</pubDate>
		<dc:creator>alexandra</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://design-notes.info/?p=2733</guid>
		<description><![CDATA[I love jQuery. It made things so much easier. if you still don&#8217;t much know it, you can read about more amazing features on their official jQuery site. Also there is a easy way to parse XML data with jQuery and here it is.
First, Include jQuery
The best way to include jQuery these days is using [...]]]></description>
			<content:encoded><![CDATA[<p>I love jQuery. It made things so much easier. if you still don&#8217;t much know it, you can read about more amazing features on their official <a href="http://jquery.com/">jQuery</a> site. Also there is a easy way to parse XML data with jQuery and here it is.</p>
<h2>First, Include jQuery</h2>
<p>The best way to include jQuery these days is using <a href="http://code.google.com/apis/ajaxlibs/documentation/">google Ajax Library</a><br />
URL for jQuery is here:<br />
<code>http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js</code></p>
<h2>Load  XML with jQuery</h2>
<p>My xml file is test.xml which I got from <a href="http://www.w3schools.com/xsl/xsl_server.asp">W3C XML tutorial</a></p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">$.ajax({ type: &quot;GET&quot;,
    url: &quot;test.xml&quot;,
    dataType: &quot;xml&quot;,
    success: parseXml
  });</pre></div></div>

<p>XML file:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;ISO-8859-1&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;catalog<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;cd<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Empire Burlesque<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artist<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Bob Dylan<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artist<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;country<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>USA<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/country<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;company<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Columbia<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/company<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;price<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>10.90<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/price<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;year<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1985<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/year<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/cd<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/catalog<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<h2>A Function to Parse XML</h2>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">function parseXml(xml)
{
  //find every Tutorial and print the author
  $(xml).find(&quot;cd&quot;).each(function()
  {
   $(&quot;#tiles&quot;).append(&quot;: &quot; + $(this).find(&quot;title&quot;).text() + &quot;&lt;br /&gt;&quot;);
  });
&nbsp;
}</pre></div></div>




ADD TO<a href="#" onclick="javascript:(function(){EN_CLIP_HOST='http://www.evernote.com';try{var x=document.createElement('SCRIPT');x.type='text/javascript';x.src=EN_CLIP_HOST+'/public/bookmarkClipper.js?'+(new Date().getTime()/100000);document.getElementsByTagName('head')[0].appendChild(x);}catch(e){location.href=EN_CLIP_HOST+'/clip.action?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title);}})();"><img src="http://img44.imageshack.us/img44/3714/picture4p.png" alt="Add To Evernote" /></a>  If this helps, why not tell your friends?


	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fdesign-notes.info%2Ftutorial%2Fusing-jquery-to-parse-xml-data%2F&amp;title=Using%20jQuery%20to%20Parse%20XML%20data" title="Reddit"><img src="http://design-notes.info/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fdesign-notes.info%2Ftutorial%2Fusing-jquery-to-parse-xml-data%2F&amp;title=Using%20jQuery%20to%20Parse%20XML%20data&amp;notes=I%20love%20jQuery.%20It%20made%20things%20so%20much%20easier.%20if%20you%20still%20don%27t%20much%20know%20it%2C%20you%20can%20read%20about%20more%20amazing%20features%20on%20their%20official%20jQuery%20site.%20Also%20there%20is%20a%20easy%20way%20to%20parse%20XML%20data%20with%20jQuery%20and%20here%20it%20is.%0D%0AFirst%2C%20Include%20jQuery%0D%0AThe%20" title="del.icio.us"><img src="http://design-notes.info/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fdesign-notes.info%2Ftutorial%2Fusing-jquery-to-parse-xml-data%2F&amp;title=Using%20jQuery%20to%20Parse%20XML%20data" title="StumbleUpon"><img src="http://design-notes.info/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fdesign-notes.info%2Ftutorial%2Fusing-jquery-to-parse-xml-data%2F&amp;t=Using%20jQuery%20to%20Parse%20XML%20data" title="Facebook"><img src="http://design-notes.info/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fdesign-notes.info%2Ftutorial%2Fusing-jquery-to-parse-xml-data%2F" title="Technorati"><img src="http://design-notes.info/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.designfloat.com/submit.php?url=http%3A%2F%2Fdesign-notes.info%2Ftutorial%2Fusing-jquery-to-parse-xml-data%2F&amp;title=Using%20jQuery%20to%20Parse%20XML%20data" title="Design Float"><img src="http://design-notes.info/wp-content/plugins/sociable/images/designfloat.png" title="Design Float" alt="Design Float" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fdesign-notes.info%2Ftutorial%2Fusing-jquery-to-parse-xml-data%2F" title="Identi.ca"><img src="http://design-notes.info/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.friendfeed.com/share?title=Using%20jQuery%20to%20Parse%20XML%20data&amp;link=http%3A%2F%2Fdesign-notes.info%2Ftutorial%2Fusing-jquery-to-parse-xml-data%2F" title="FriendFeed"><img src="http://design-notes.info/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fdesign-notes.info%2Ftutorial%2Fusing-jquery-to-parse-xml-data%2F&amp;submitHeadline=Using%20jQuery%20to%20Parse%20XML%20data&amp;submitSummary=I%20love%20jQuery.%20It%20made%20things%20so%20much%20easier.%20if%20you%20still%20don%27t%20much%20know%20it%2C%20you%20can%20read%20about%20more%20amazing%20features%20on%20their%20official%20jQuery%20site.%20Also%20there%20is%20a%20easy%20way%20to%20parse%20XML%20data%20with%20jQuery%20and%20here%20it%20is.%0D%0AFirst%2C%20Include%20jQuery%0D%0AThe%20&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://design-notes.info/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fdesign-notes.info%2Ftutorial%2Fusing-jquery-to-parse-xml-data%2F&amp;title=Using%20jQuery%20to%20Parse%20XML%20data&amp;body=I%20love%20jQuery.%20It%20made%20things%20so%20much%20easier.%20if%20you%20still%20don%27t%20much%20know%20it%2C%20you%20can%20read%20about%20more%20amazing%20features%20on%20their%20official%20jQuery%20site.%20Also%20there%20is%20a%20easy%20way%20to%20parse%20XML%20data%20with%20jQuery%20and%20here%20it%20is.%0D%0AFirst%2C%20Include%20jQuery%0D%0AThe%20" title="Ping.fm"><img src="http://design-notes.info/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://design-notes.info/tutorial/using-jquery-to-parse-xml-data/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
