Results 1 to 2 of 2

Thread: find xml node using jquery

  1. #1

    Thread Starter
    Fanatic Member davebat's Avatar
    Join Date
    Dec 2002
    Posts
    727

    find xml node using jquery

    Hi,

    I have an asp .net image map loaded from xml, I am using jQuery to highlight the map.

    At the same time I want to look up some descriptive text held in the xml. So far I have this.

    Code:
      $.ajax({
                type: "GET",
                url: "/xml/" + feed,
                dataType: "xml",
                success: function(xml) {
                $(xml).find('area').each(function() {
                    
                        var Helptext = $(this).find('helptext').text();
                        $('#ctl00_ContentPlaceHolder1_desc').html("<p class='helpHeader'>" + DB + "</p><p>" + Helptext.toString() + "</p>");
    
                    });
                }
            });
    And my xml looks like this

    Code:
    <area>
    		<componentDrillDown>N</componentDrillDown>
    		<component>NA</component>
    		<shape>poly</shape>
    		<helptext>to do</helptext>
    		<title>Light</title>
    		<coords>343, 25, 366, 15, 390, 13, 408, 15, 416, 19, 420, 22, 410, 32, 395, 40, 377, 40, 361, 38, 351, 33</coords>
    	</area>
    At the minute this just gets the last helptext node in the file, how would I find the helptext based on the sibling node title's text?

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: find xml node using jquery

    Hello,

    You should be able to do something like this:

    Code:
    $(xml).find("area helptext:contains('to do')")
    See here:

    http://www.ibm.com/developerworks/xm...x.html?ca=drs-

    For more information.

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width