开发者

Parsing an RSS feed with jfeed fails only for some fields

I'm using the latest version of jFeed with the latest jQuery. I know jFeed is rather outdated, and no longer supported, but firefox seems to be the only browser that is having an issue parsing an RSS feed using this setup. I've modified jFeed to pull a 'date' field which is in the XML node "dc:date". The only thing I 开发者_如何学运维can think of is firefox is having an issue because of the semicolon. (All other fields are working fine and do not have this character in them).

I've updated the jFeed prototype to include the date field and the modified portion in jFeed that is parsing fine in everything other than firefox looks like this now:

c.date = jQuery(this).find("date").eq(0).text();

No errors are being thrown, and simply a null value is being returned.


You need to escape the : in there with \\ as it is a reserved character for jQuery.

See the docs on selectors,

If you wish to use any of the meta-characters (#;&,.+*~':"!^$=>|/@ ) as a literal part of a name, you must escape the character with two backslashes: \\. For example, if you have an an input with name="names[]", you can use the selector $("input[name=names\\[\\]]").

Try,

jQuery(this).find("dc\\:date")
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜