rss

Parse RSS pubDate to Date object in java

梦想与她 提交于 2019-11-26 19:23:50
问题 How can I parse a pubDate from a RSS feed to a Date object in java. The format in the RSS feed: Sat, 24 Apr 2010 14:01:00 GMT What I have at the moment: DateFormat dateFormat = DateFormat.getInstance(); Date pubDate = dateFormat.parse(item.getPubDate().getText()); But this code throws an ParseException with the message Unparseable date 回答1: You can define the date format you are trying to parse, using the class SimpleDateFormat: DateFormat formatter = new SimpleDateFormat("EEE, dd MMM yyyy HH

KXmlParser throws “Unexpected token” exception at the start of RSS pasing

血红的双手。 提交于 2019-11-26 18:17:06
问题 I'm trying to parse an RSS feed from Monster on Android v.17 using this URL: http://rss.jobsearch.monster.com/rssquery.ashx?q=java To get the content I'm using HttpUrlConnection in the following fashion this.conn = (HttpURLConnection) url.openConnection(); this.conn.setConnectTimeout(5000); this.conn.setReadTimeout(10000); this.conn.setUseCaches(true); conn.addRequestProperty("Content-Type", "text/xml; charset=utf-8"); is = new InputStreamReader(url.openStream()); What comes back is as far as

preg_match(); - Unknown modifier '+' [duplicate]

泄露秘密 提交于 2019-11-26 17:55:12
This question already has an answer here: Warning: preg_replace(): Unknown modifier ']' 3 answers Alright, so I'm currently working on parsing an RSS feed. I've gotten the data I need no problem, and all I have left is parsing the game title. Here is the code I currently have (ignore the sloppiness, it is just a proof of concept): <?php $url = 'http://raptr.com/conexion/rss'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); curl_close($ch); $xml = new SimpleXMLElement($result); $lastgame = $xml->channel->item[0]-

How to replace the text of a node using DOMDocument

夙愿已清 提交于 2019-11-26 16:39:50
问题 This is my code that loads an existing XML file or string into a DOMDocument object: $doc = new DOMDocument(); $doc->formatOutput = true; // the content actually comes from an external file $doc->loadXML('<rss version="2.0"> <channel> <title></title> <description></description> <link></link> </channel> </rss>'); $doc->getElementsByTagName("title")->item(0)->appendChild($doc->createTextNode($titleText)); $doc->getElementsByTagName("description")->item(0)->appendChild($doc->createTextNode(

php simplexml get a specific item based on the value of a field

社会主义新天地 提交于 2019-11-26 14:54:05
问题 Is there a way i can get a specific item with SimpleXML ? For example, i would like to get the title of an item having ID set to 12437 with this example xml : <items> <item> <title>blah blah 43534</title> <id>43534</id> </item> <item> <title>blah blah 12437</title> <id>12437</id> </item> <item> <title>blah blah 7868</title> <id>7868</id> </item> </items> 回答1: Here are 2 simple ways of doing what you want, one is iterating with each item like this: <?php $str = <<<XML <items> <item> <title

How can I get started making a C# RSS Reader?

[亡魂溺海] 提交于 2019-11-26 11:54:07
问题 I have been wanting to make a RSS reader for a while now (just for fun), but I don\'t have the slightest idea of where to start. I don\'t understand anything about RSS. Are there any good tutorials on RSS and how to implement it in an application (not a tutorial on how to make a RSS reader, that would be too easy). 回答1: See http://msdn.microsoft.com/en-us/library/bb943474.aspx http://msdn.microsoft.com/en-us/library/system.servicemodel.syndication.syndicationfeed.aspx http://msdn.microsoft

【web标准设计】学习、提高、欣赏网站推荐

試著忘記壹切 提交于 2019-11-26 11:46:46
【web标准设计】学习、提高、欣赏网站推荐 (转) 文章包含的一些粗俗、庸俗、恶心的言语可能造成您阅读后的不适感,请谨慎选择是否阅读。如你自愿阅读本文,因粗俗、庸俗、恶心的言语给您所造成的任何后果,本文作者不负任何责任。 华丽的中指 基础知识的学习 XHTML、CSS、JavaScript的基础知识,只能自己看书来系统的学习一下。推荐的书籍可以看这个的网址: web标准设计推荐书籍 如果,你说什么“看书学习基础知识好无聊,有没有什么捷径可以不那么费力气就学会”。那我只能华丽的向你伸出右手中指,然后对你说“如果这个手的所有手指代表了各种学习的途径,那么,请相信我,中指绝对代表着‘看书系统学习’这条途径。因为它最长,可以挖的最深,也是最有效的。” 理论知识的提高 我并非崇洋媚外,但是不得不承认,有些知识资料,国外的要比国内的丰富和有深度一些。下面是我在google的IG中,订阅了RSS的有关web标准设计的一些专业网站。下面会一一介绍,并提供网址和RSS地址,如果你有兴趣的话,请过去看看。请相信我,最多一坨屎的时间,你就会爱上它们。 alistapart 1:alistapart 简介:一个关于网页设计制作的电子杂志。不定期的进行出版、更新。每期都有2-10篇左右的文章。文章设计网页设计的方方面面。各种XHTML标签的研究,用户体验……等等都会涉及到。最难得的是

How do I parse and convert DateTime’s to the RFC 822 date-time format?

青春壹個敷衍的年華 提交于 2019-11-26 10:45:27
问题 How do I convert a DateTime structure to its equivalent RFC 822 date-time formatted string representation and parse this string representation back to a DateTime structure in .NET? The RFC-822 date-time format is used in a number of specifications such as the RSS Syndication Format. 回答1: Try this: DateTime today = DateTime.Now; String rfc822 = today.ToString("r"); Console.WriteLine("RFC-822 date: {0}", rfc822); DateTime parsedRFC822 = DateTime.Parse(rfc822); Console.WriteLine("Date: {0}",

Best Way to read rss feed in .net Using C#

巧了我就是萌 提交于 2019-11-26 10:08:41
问题 What is the best way to read RSS feeds ? I am using XmlTextReader to achieve this. Is there any other best way to do it? XmlTextReader reader = new XmlTextReader(strURL); DataSet ds = new DataSet(); ds.ReadXml(reader); After reading the RSS feed using XmlTextReader , is there any way I can populate data to ListItem instead of DataSet ? 回答1: The System.ServiceModel.Syndication namespace has some stuff for you, namely the SyndicationFeed class. This is a fairly simple example. http://blogs.msdn

How to parse CDATA HTML-content of XML using SimpleXML?

五迷三道 提交于 2019-11-26 10:00:11
问题 I am trying to display Xml content in to tables, all works perfectly but some content in the tag that i don\'t want to display, I want only image but not November 2012 calendar from 5.10 The Test like in xml, <content:encoded><![CDATA[<p>November 2012 calendar from 5.10 The Test</p> <p><a class=\"shutterset_\" href=\'http://trance-gemini.com/wordpress/wp-content/gallery/calendars/laura-bertram-trance-gemini-145-1080.jpg\' title=\'<br>November 2012 calendar from 5.10 The Test<br> <a href="</a>