maryb86
07-05-2010, 06:51 PM
Hello,
I'm using jquery to access an xml doc formatted like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<portfolio>
<painting>
<name>Poolside</name>
<price>28</price>
<size>16" x 20"</size>
<media>Acrylics on Canvas</media>
<thumbnail>tn_poolside.jpg</thumbnail>
<full_image>fl_poolside.jpg</full_image>
<imagekind>b77a7970-8b61-4597-976d-7ef1151261d8</imagekind>
<date>01/07/2010</date>
</painting>
<painting>
<name>Raindrops</name>
<price>22</price>
<size>16" x 20"</size>
<media>Acrylics on Canvas</media>
<thumbnail>tn_raindrops.jpg</thumbnail>
<full_image>fl_raindrops.jpg</full_image>
<imagekind>bba0fd6f-3d7a-45f8-ab73-091af310a556</imagekind>
<date>01/07/2010</date>
</painting>
</portfolio
and what I would like to do is to search the <thumbnail> tag for a specific string. I'd then use that to populate a div with the rest of the content inside the <painting> tag that the <thumbnail> is a child of. I see many examples of using $(xml).find('painting').each(function(){}) but these only seem to work for the tags and not for the text nodes inside. Using .text() will only give you the value, it won't actually let you search the xml doc for a string inside of it.
How can I do this?
I'm using jquery to access an xml doc formatted like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<portfolio>
<painting>
<name>Poolside</name>
<price>28</price>
<size>16" x 20"</size>
<media>Acrylics on Canvas</media>
<thumbnail>tn_poolside.jpg</thumbnail>
<full_image>fl_poolside.jpg</full_image>
<imagekind>b77a7970-8b61-4597-976d-7ef1151261d8</imagekind>
<date>01/07/2010</date>
</painting>
<painting>
<name>Raindrops</name>
<price>22</price>
<size>16" x 20"</size>
<media>Acrylics on Canvas</media>
<thumbnail>tn_raindrops.jpg</thumbnail>
<full_image>fl_raindrops.jpg</full_image>
<imagekind>bba0fd6f-3d7a-45f8-ab73-091af310a556</imagekind>
<date>01/07/2010</date>
</painting>
</portfolio
and what I would like to do is to search the <thumbnail> tag for a specific string. I'd then use that to populate a div with the rest of the content inside the <painting> tag that the <thumbnail> is a child of. I see many examples of using $(xml).find('painting').each(function(){}) but these only seem to work for the tags and not for the text nodes inside. Using .text() will only give you the value, it won't actually let you search the xml doc for a string inside of it.
How can I do this?