我在使用Google Picasa服务的API时遇到了困难。
假设我不想通过jquery显示这个值:
<entry>
<id>
https://picasaweb.google.com/data/entry/api/user/userID/albumid/albumID/photoid/5813338978197482482
</id>
<exif:tags>
<exif:time>1203311251000</exif:time>
<exif:imageUniqueID>uniqueID</exif:imageUniqueID>
</exif:tags>
<media:group>
<media:content url="https://lh6.googleusercontent.com/Penguins.jpg" height="384" width="512" type="image/jpeg" medium="image"/>
<media:credit>user</media:credit>
<media:description type="plain"/>
<media:keywords/>
<media:thumbnail url="https://lh6.googleusercontent.com/s72/Penguins.jpg" height="54" width="72"/>
<media:thumbnail url="https://lh6.googleusercontent.com/s144/Penguins.jpg" height="108" width="144"/>
<media:thumbnail url="https://lh6.googleusercontent.com/s288/Penguins.jpg" height="216" width="288"/>
<media:title type="plain">Penguins.jpg</media:title>
</media:group>
</entry>从条目树中读取值时没有问题,但问题是从exif:tag或media:group开始。这是用于读取xml的函数
$(xml).find('entry').each(function()
{
var item = ""
item += "<li style='float:left;'>";
item += $(this).find('title').text()
item += "</li>";
$(".albums").append(item);
}); 谢谢
发布于 2012-11-22 05:16:39
水晶球时间到了!我猜你是想做这样的事情:
var $xml = $(/* get xml string from somewhere */);
var $entryId = $xml.find('entry > id'); // works
var $entryExifTags = $xml.find('entry > exif:tags'); // doesn't work这是因为some characters, including :, have special meaning in jQuery selectors. Therefore you need to escape them
var $entryExifTags = $xml.find('entry > exif\\:tags');https://stackoverflow.com/questions/13502148
复制相似问题