Given this sample XML:
<patient>
<name>
<given>Bob</given>
<family>Dole</family>
</name>
</patient>
I would like to create an object, patient and be able to do something like alert(patient.name.given) and get a popup that says "Bob". My actual data is much more complex than this so I would also need to account for attributes and arrays.
How can this be achieved?
I'm currently using parseXML() but I'd rather not have to type alert($xml.find("patient").find("name").find("given").text)