vsri


Hey,

I have been using popfly for the past couple fo weeks, during which i've played with creating blocks and mashup's. A strange thing caught my attention during this period. Its regarding the getElementsByTagName property between IE7 and Firefox.

When I use getElementsByTagName in a block, the block works fine in Firefox but in IE7 it always returns an empty list of elements. I'm not very proficient at Javascript, so I doubt If im missing anything here. Following is the block code which is the culprit.

var albumArray = new Array();
var root = environment.getXml("http://picasaweb.google.com/data/feed/api" + params, "picasa");

var album_entries = root.getElementsByTagName('entry');

T
he album_entries variable is always empty in IE7 but works as expected in Firefox. I checked the contents of root and that seems to be fine. So, I would like to know if any one would help me identify the problem here.

Thanks in advance,
Sri.



Re: IE7 vs Firefox in Windows XP SP2

AndyS


Unfortunatley getElementsByTagName behaves differently across browsers Sad, i haven't looked at the picasa feed (if you could give me the full URL i can have a look) but a common problem is the use of namespaces in XML e.g. <foo:bar /> in IE using getElementsByTagName('bar') won't return any results.You could use the selectNodes method which we implemented to perform the same across browsers, that is you pass in an Xpath query and get the resulting array of nodes.





Re: IE7 vs Firefox in Windows XP SP2

vsri

Hey Andy, Thanks for the quick responce,

Here's the link to the Picasa Feed (http://picasaweb.google.com/data/feed/api/user/srikanth.vasireddy kind=album) and the feed goes like this
(http://code.google.com/apis/picasaweb/gdata.html)

<feed xmlns='http://www.w3.org/2005/Atom'
xmlns:media='http://search.yahoo.com/mrss/'
xmlns:gphoto='http://schemas.google.com/photos/2007'>
<id>http://picasaweb.google.com/data/feed/api/user/liz</id>
<updated>2007-03-06T00:08:51.553Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/photos/2007#user'></category>
<title type='text'>liz</title>
<subtitle type='text'></subtitle>
<icon>http://picasaweb.google.com/image/liz/imageKey/liz.jpg imgmax=64&amp;crop=1</icon>
<link rel='http://schemas.google.com/g/2005#feed'
type='application/atom+xml'
href='http://picasaweb.google.com/data/feed/api/user/liz'>
</link>
<link rel='alternate' type='text/html'
href='http://picasaweb.google.com/liz'></link>
<link rel='self' type='application/atom+xml'
href='http://picasaweb.google.com/data/feed/api/user/liz start-index=1&amp;max-results=10000&amp;kind=album'>
</link>
<author>
<name>Liz</name>
<uri>http://picasaweb.google.com/liz</uri>
</author>
<generator version='1.00' uri='http://picasaweb.google.com/'>Picasaweb</generator>
<gphoto:user>liz</gphoto:user>
<gphoto:nickname>Liz</gphoto:nickname>
<gphoto:thumbnail>http://picasaweb.google.com/image/liz/imageKey/liz.jpg imgmax=64&amp;crop=1</gphoto:thumbnail>
<entry>
<id>http://picasaweb.google.com/data/entry/api/user/liz/albumid/albumID</id>
<published>2007-03-01T08:00:00.000Z</published>
<updated>2007-03-02T02:09:52.000Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/photos/2007#album'></category>
<title type='text'>Netherfield Park</title>
<summary type='text'>Photos of my vacation.</summary>
<rights type='text'>public</rights>
<link rel='self' type='application/atom+xml'
href='http://picasaweb.google.com/data/entry/api/user/liz/albumid/albumID'>
</link>
<link rel='http://schemas.google.com/g/2005#feed'
type='application/atom+xml'
href='http://picasaweb.google.com/data/feed/api/user/liz/albumid/albumID'>
</link>
<link rel='alternate' type='text/html'
href='http://picasaweb.google.com/liz/NetherfieldPark'></link>
<author>
<name>Liz</name>
<uri>http://picasaweb.google.com/liz</uri>
</author>
<gphoto:id>albumID</gphoto:id>
<gphoto:name>NetherfieldPark</gphoto:name>
<gphoto:location></gphoto:location>
<gphoto:access>public</gphoto:access>
<gphoto:timestamp>1172736000000</gphoto:timestamp>
<gphoto:numphotos>184</gphoto:numphotos>
<gphoto:numphotosremaining>316</gphoto:numphotosremaining>
<gphoto:bytesUsed>11060624</gphoto:bytesUsed>
<gphoto:user>liz</gphoto:user>
<gphoto:nickname>Liz</gphoto:nickname>
<gphoto:commentingEnabled>true</gphoto:commentingEnabled>
<gphoto:commentCount>0</gphoto:commentCount>
<media:group>
<media:title type='plain'>Netherfield Park</media:title>
<mediaBig Smileescription type='plain'>Photographs taken on vacation.</mediaBig Smileescription>
<media:keywords></media:keywords>
<media:content
url='http://picasaweb.google.com/image/liz/imageKey/Netherfield.jpg'
type='image/jpeg' medium='image'>
</media:content>
<media:thumbnail
url='http://picasaweb.google.com/image/liz/imageKey/Netherfield.jpg imgmax=160&amp;crop=1'
height='160' width='160'>
</media:thumbnail>
<media:credit>Liz</media:credit>
</media:group>
</entry>
</feed>

When I try getElementsByTagName('entry') it returns an Empty List. I'll try with selectNodes and make it work.

Thanks again for the Info,
Sri





Re: IE7 vs Firefox in Windows XP SP2

billc.cn

I think that root object is the node for the whole HTML document (same to the document object you will use in a web page), so you will need to get the feed element first before you can use any of its children.




Re: IE7 vs Firefox in Windows XP SP2

Timothy Rice MSFT

Actually, it looks like Picasa is returning the xml as "application/atom+xml". XmlHttpRequest will only parse xml if the type is text/xml. I'll log a suggestion to add a workaround. But you should be able to do a environment.getText and feed that to the XMLDOM to workaround this restriction in the meantime.





Re: IE7 vs Firefox in Windows XP SP2

Hari Menon

Is there a direct way in which we can load the the text to a xml dom such that it works on all popfly supported platforms Or do we have to write the browser dependent code ourselves

This mime type issue occurs in other places too I suspect. For example del.icio.us rss feeds seem to be fetchable with environment.getXml in firefox, but not in ie7. A quick glance shows that the mime type is application/xhtml+xml for the feed. (I am still to investigate in detail)




Re: IE7 vs Firefox in Windows XP SP2

AndyS

At the moment you could only use getText() and then pass the string into an xml parser which is specfic to each platform, so you would have to do the browser detection Sad.

The only other thing we could do is take an overload that will always try to fetch an xml object when it fails directly we can do the browser specfic parsing as part of Popfly. Unfortunatley this would have to be in another release.





Re: IE7 vs Firefox in Windows XP SP2

Bulat Gafurov

Is it possible for Popfly team to change the cross-domain proxy to explicitly convert "application/atom+xml" content type to "text/xml" Those two lines will allow to get rid off ugly cross-browser workarounds in many blocks which encounter this problem. I did this modification on my local Popfly SDK and it works fine.
Perfectly, I think this issue with XmlHttpRequest object should be passed to IE team to be included in incremental update.