Friday, 15 January 2010

Parsing node-specific XML Using JQuery -


There are many other terms related to this, but I can not find the answer to my question. I am trying to parse the XML file of the following form to return items only under the 'subGroup' node.

Here is sample XML:

   

And what I currently use to parse it:

  $ Get (url, {}, function (data) {$ ('item', data) .each (function (i) {var id = $ (this) .find ("id"). Text (); var title = $ (This) .find ("title"). Text (); var description = $ (this) .find ("description"). Text (); list.append ('
  • gt;' + id + ':' + Title + ':' + description + '& lt; / li & gt;';)}};});
  • The problem is that items listed under 'Result group' are also selected by $ ('item', data). I appreciate it if someone can choose only those elements under a specific node, in this case the 'sub group' node.

    Thank you in advance for your help!

    $ (use 'sub group' item ', data)


    No comments:

    Post a Comment