Possible Duplicate:
XML parsing of a variable string in JavaScript
As part of a server-client project I have an object in a C#-server app which is serialized to an XML string. The string looks like this:
<?xml version="1.0" encoding="utf-8"?>
<CandyShop xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<CandyList>
<CandyDesc>
<Taste>Taste1</Taste>
<Color>Color1</Color>
</CandyDesc>
<CandyDesc>
<Taste>Taste2</Taste>
<Color>Color2</Color>
</CandyDesc>
</CandyList>
<!-- Other stuff -->
</CandyShop>
I then transfer this XML string via websockets to a javascript-based HTML client. I'd like to deserialize the initial class so that I could just type
var aColor = CandyShop.CandyList.CandyDesc[0].Color;
For JSON strings I just use
JSON.parse(stringToParse);
Is there an equivalent for XML?
Bonus if I can pre-create a CandyShop class and map the fields directly.