473,320 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Parsing the "description" element of rss/xml

Hello, I have php code which takes an rss feed and outputs it on a page of my website. For each item it shows the link, title and description.

My problem is the description element contains a lot of information (some links and other stuff) and I want to extract one of the links out of this information, so that on my webpage I am shown the link, title and the link I want out of the description, for every item. How would I achieve this? If no-one knows can anyone point me to books which might know.


Here is the description tag:
Expand|Select|Wrap|Line Numbers
  1. <description>submitted by &lt;a href=&quot;http://www.examplesite.com/user/hoopy001&quot;&gt; hoopy001 &lt;/a&gt; &lt;br/&gt; &lt;a href=&quot;http://www.telegraph.co.uk/earth/wildlife/6187320/Snake-with-foot-found-in-China.html&quot;&gt;[link]&lt;/a&gt; &lt;a href="http://www.examplesite.com/steep/meeic/comments/9feftggfy/snake_with_foot_found_in_china_telegraph/"&gt;[comment]&lt;/a&gt;</description>
In this example I want the link telegraph.co.uk with the word [link] after it, which i bolded out.

Any ideas would be gratefully received.

Thank you
Oct 2 '09 #1
1 2348
Dormilich
8,658 Expert Mod 8TB
possibility one
extract all the text content and use PHP to filter the link via RegEx

possibility two
write the html content as such using the xhtml namespace, then you can use XPath to look for the appropriate anchor element.
Oct 3 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: John Phelan-Cummings | last post by:
What Works I have a subform (Events1) with a combo box field called “eventname”. The combo box displays the correct information from the second column of its lookup table, i.e., column #1:...
11
by: MLH | last post by:
I have a query field... Description: & "2-tone" When I run it, the output in that field is empty. If I change the name to MyDescription - it works fine. I noticed the query field has a...
4
by: marclinenberger | last post by:
If you right click on a table name in the tables window and click on properties you get a dialog box that allows you to add a description of the table. My question is using VBA how do you access...
1
by: Pucca | last post by:
I'm using vs2005, .net 2.0 on Windows 2000 server. When I double click on an entry of the "Security" log in the system's "Event Viewer", a Property window pops up. In this window, there is a...
0
by: bbcrock | last post by:
I have approximately 400 column descriptions stored in an MS Word document in MS Word tables that I want to insert into SQL Server utilizing the sys.sp_addextendedproperty function. Cutting and...
4
by: thaytu888888 | last post by:
Here is my codes in aspx page: <td colspan="2" class="main_menu" runat="server" onclick='toggleDisplay(<%#Eval("description")%>);'><%#Eval("description")%></td> Here is in "View source": ...
2
by: atishrg | last post by:
Hello All Need your help.. I created addin for outlook 2007 in vs2005(vb.net)... It is working fine now I Migrated that to vs2008 and created setup for that in vs2008...
8
by: ismailc | last post by:
Hi, I would like to change the text color of (<xsl:value-of select="Description") onmouseover of image. the javascript works, it's just that i can seem to get the name correct <td>...
3
by: raghudr | last post by:
Hi all, I am parsing a .xml file.My main intention is to retrieve the name value of node "Signal":- "Name Value" which is "rag". i want to store only the <signal"name value" that is only...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.