简体   繁体   中英

How to avoid empty RSS Feed tags with javascript?

I've got my RSS feed in xml file which I can not edit. The problem is that some of the tags inside are empty or they contain other html tags such as <b></b>. I built my own JavaScript rss feed reader but it's not working unless I will get rid of all empty tags and all html tags. Any ideas?

Example 1 - which doesn't work:

/* ... */
<item>
<pubDate>04 Feb</pubDate>
<closeDate>11 Feb</closeDate>
<snappytitle></snappytitle>
<title><b>Web Developer</b></title>
<grade>4</grade>
</item>
/* ... */

Example 2 - which does work:

/* ... */
<item>
<pubDate>04 Feb</pubDate>
<closeDate>11 Feb</closeDate>

<title>Web Developer</title>
<grade>4</grade>
</item>
/* ... */

Well.. the thing is that I can not edit xml file as it's provided by the third party. To read this xml I am using modify version of the simple javaScript Ajax Feed reader which I found here

I am note sure how to modify this script to still work even if some tags inside of the xml file are empty.. as per example I have before.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM