0

How will I parse this XML using jQuery?

<item>

<station></station>
<headline><![CDATA[]]></headline>
<showDate>12/28/2010</showDate>
<showTime></showTime>
<doorsOpen></doorsOpen>
<buylink></buylink>
<description><![CDATA[]]></description>
<pubDate>Mon, 27 Dec 2010 10:48:28 PST</pubDate>
</item>

I have to display month and date separately..

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by parry_kulk
0

Write a javascript function which will accept the above xml as a parameter and than parse the xml using jquery.

function parseItemXML(itemXML){		
		$(itemXML).find('item').each(function(){//For each item element in the xml
			var showDateTxt = $(this).find('showDate').text(); //get the date
			var showDate = $.datepicker.parseDate( "mm/dd/yy", showDateTxt); //parse the date using the datapicker jquery ui component
			alert("Date:"+showDate.getDate()+" Month:"+(showDate.getMonth()+1));
		});
	}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.