I have the following xml which I parse using jquery.
However I’m stuck at displaying only the cities and dates grouped by the title.
How can I parse the xml so that the final output would be like this
Test event 1 – oslo(2011/08/11), dallas(2011/11/11)
Test event 2 – new york(…), seattle(…)
Any Help would be appreciated,
Thanks,
Terry
<root>
<item guid="np_108886">
<title>Test event 1</title>
<description>lorem ipsum</description>
<specfields>
<city>oslo</city>
<startdate>2011/08/11</startdate>
</specfields>
</item>
<item guid="np_108886">
<title>Test event 1</title>
<description>lorem ipsum</description>
<specfields>
<city>dallas</city>
<startdate>2011/11/11</startdate>
</specfields>
</item>
<item guid="np_108886">
<title>Test event 2</title>
<description>lorem ipsum</description>
<specfields>
<city>new york</city>
<startdate>2011/09/11</startdate>
</specfields>
</item>
<item guid="np_108886">
<title>Test event 2</title>
<description>lorem ipsum</description>
<specfields>
<city>seattle</city>
<startdate>2011/09/11</startdate>
</specfields>
</item>
</root>
http://jsfiddle.net/XnmNU/6/ – working jFiddle {edit child selectors!}
My version compares the previouse title against the current to decern if its a dupe or not, sorry i do not have time to absolutly optimise the code i am at work 🙁
outputs>
Start
Test event 1 — oslo (2011/08/11)
dallas (2011/11/11)
Test event 2 — new york (2011/09/11)
seattle (2011/09/11)