سؤال

I have a javascript test project where i am trying to deserialize an XML document (loaded from a remote XML file) into a locally defined class object.

I am unsure how to go about achieving this. How to deserialize an XML object into a javascript class type?

هل كانت مفيدة؟

المحلول

what about

var xml = "<rss version='2.0'><channel><title>RSS Title</title></channel></rss>",
  xmlDoc = $.parseXML( xml ),
  $xml = $( xmlDoc ),
  $title = $xml.find( "title" );

$title.text() would return your title value

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top