开发者

XML parsing in Chrome vs IE and Firefox

I'm using JQuery to parse some XML returned from a server, and using it to populate a table; unfortunately, this only works in Firefox and IE, but not Chrome. Relevant code below:

var xmlDoc = $.parseXML(xml);
$(xmlDoc).find('z\\:row').each (
    function ()
    {//this stuff never gets executed in Chrome}

I've tried using $(xmlDoc).find("[nodeName=z:row]") as well, but that gives me an invalid syntax error. I've verified that xml, as passed to $.parseXML, is indeed a valid and complete XML document.

(The reason I'm looking for 'z:row' is that this is output from SharePoint Web Services.)

Any开发者_运维技巧 help would be greatly appreciated! :)

Edit: Problem resolved. Turns out whoever posted the nodeName syntax on the site I was looking at posted invalid syntax. It needs to be '[nodeName="z:row"]' to be a self-contained string, all quotes mandatory. * shakes head *


I think your problem lies in the line break after function()

JavaScript has implicit semicolon insertion after a line. On some browsers they can tell that a function() shouldn't get a line break, however in the ECMAScript standard it's not there.

Do function(){ (move the { up)

Edit: Oh if it is resolved, then ignore the above. However it's still good to follow a development guide such as the http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml


Problem resolved. Turns out whoever posted the nodeName syntax on the site I was looking at posted invalid syntax. It needs to be '[nodeName="z:row"]' to be a self-contained string, all quotes mandatory. * shakes head *

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜