|
-
Oct 19th, 2009, 10:18 PM
#1
Thread Starter
New Member
extracting specific text from loaded html source
Hey, I am having some serious problems getting this string manipulation down, I was wondering if someone could help me out. I'm trying to extract the text fields inbetween the code but the text is always changing so I'm not sure how to keep this dynamic. In put them in to the proper text boxes.
So text box 1 might be Date: then it pulls the date.
and there are multiple listings. so I need it to loop until the end of </table>
Code:
<tr valign="top"><td class="MNSOdd" nowrap>Oct 19</td><td style="word-wrap:break-word;" class="MNSOdd"><a href="/getjob.asp?JobID=84063578&AVSDM=2009%2D10%2D19+19%3A39%3A00&Logo=0&cy=US&st=GA&aj=Georgia">Regional CRA II</a><br>PRA International is one of the world's leading global clinical research organizations, conducting clinical trials in 65 countries across six continents. PRA provides outsourced clinical services across all phases of pharmaceutical and biotech drug development. Through its 30+ years of experience, PRA has developed the operational and therapeutic expertise to provide high quality, global service w ...[<a href="/getjob.asp?JobID=84063578&AVSDM=2009%2D10%2D19+19%3A39%3A00&Logo=0&cy=US&st=GA&aj=Georgia">more</a>]<br><br><table border="0" cols="2" cellspacing="0" cellpadding="0" id="Source"><tr><td valign="top" class="MNSOdd" nowrap><span class="MNSSummaryLabel">Relevant Work Experience:</span> </td><td class="MNSOdd">2+ to 5 Years</td></tr><tr><td valign="top" class="MNSOdd" nowrap><span class="MNSSummaryLabel">Career Level:</span> </td><td class="MNSOdd">Experienced (Non-Manager)</td></tr><tr><td valign="top" class="MNSOdd" nowrap><span class="MNSSummaryLabel">Education Level:</span> </td><td class="MNSOdd">Bachelor's Degree</td></tr><tr><td valign="top" class="MNSOdd" nowrap><span class="MNSSummaryLabel">Job Type:</span> </td><td class="MNSOdd">Employee</td></tr><tr><td valign="top" class="MNSOdd" nowrap><span class="MNSSummaryLabel">Job Status:</span> </td><td class="MNSOdd">Full Time</td></tr></table><br /></td><td class="MNSOdd">PRA International</td><td class="MNSOdd">Telecommute</td></tr>
<tr valign="top"><td class="MNSEven" nowrap>Oct 19</td><td style="word-wrap:break-word;" class="MNSEven"><a href="/getjob.asp?JobID=84063592&AVSDM=2009%2D10%2D19+19%3A44%3A00&Logo=0&cy=US&st=GA&aj=Georgia">Product Development Engineer</a><br>Description: This position is in our emerging Product Development Department. The candidate will help manage and coordinate product development projects. Evaluates and resolves technical feasibility, design optimization and production issues. Ensures that labeling and marketing /promotional literature match product specifications. Researches and monitors existing client base and industry developme ...[<a href="/getjob.asp?JobID=84063592&AVSDM=2009%2D10%2D19+19%3A44%3A00&Logo=0&cy=US&st=GA&aj=Georgia">more</a>]<br><br><table border="0" cols="2" cellspacing="0" cellpadding="0" id="Source"><tr><td valign="top" class="MNSEven" nowrap><span class="MNSSummaryLabel">Relevant Work Experience:</span> </td><td class="MNSEven">2+ to 5 Years</td></tr><tr><td valign="top" class="MNSEven" nowrap><span class="MNSSummaryLabel">Career Level:</span> </td><td class="MNSEven">Experienced (Non-Manager)</td></tr><tr><td valign="top" class="MNSEven" nowrap><span class="MNSSummaryLabel">Education Level:</span> </td><td class="MNSEven">Bachelor's Degree</td></tr><tr><td valign="top" class="MNSEven" nowrap><span class="MNSSummaryLabel">Job Type:</span> </td><td class="MNSEven">Employee</td></tr><tr><td valign="top" class="MNSEven" nowrap><span class="MNSSummaryLabel">Job Status:</span> </td><td class="MNSEven">Full Time</td></tr></table><br /></td><td class="MNSEven">DiversiTech Corporation</td><td class="MNSEven">Conyers, GA 30012</td></tr> <table>
Please help
-
Oct 20th, 2009, 03:29 PM
#2
Thread Starter
New Member
Re: extracting specific text from loaded html source
bump
-
Oct 20th, 2009, 03:40 PM
#3
Re: extracting specific text from loaded html source
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
-
Oct 20th, 2009, 03:41 PM
#4
Re: extracting specific text from loaded html source
Hey,
Have you heard of Regular Expressions?
This would seem to be a perfect fit for what you have described. It is quite a big topic, but one which is well worth learning.
You will find some links in my signature that will help you get started, and if you search this forum, you will find lots of examples.
Gary
-
Oct 20th, 2009, 03:43 PM
#5
Thread Starter
New Member
Re: extracting specific text from loaded html source
Will reg expressions work if the text that im trying to extract is always changing?
-
Oct 20th, 2009, 03:46 PM
#6
Re: extracting specific text from loaded html source
Hey,
I am not sure that I follow exactly?!! Can you clarify?
At some point in the execution of your code, you are going to have a string, contains the text that you want to search, you would apply the Regular Expression to that string, and do "something" with any matches that it finds.
Gary
-
Oct 20th, 2009, 03:50 PM
#7
Thread Starter
New Member
Re: extracting specific text from loaded html source
Im trying to pull the data inbetween the HTML tags Ive never used RegEx its very confusing. I'm used to just trimming.
so for instance in the first line of code, im trying to pull "Regional CRA II" and put it in a textbox and then pull and put this in a different text box:
" PRA International is one of the world's leading global clinical research organizations, conducting clinical trials in 65 countries across six continents. PRA provides outsourced clinical services across all phases of pharmaceutical and biotech drug development. Through its 30+ years of experience, PRA has developed the operational and therapeutic expertise to provide high quality, global service w ... "
And if you look at the next line of code, the text that im trying to pull changes. So do I need to search for tags and then extract the data inbetween into a string?
Last edited by whatsmyname123; Oct 20th, 2009 at 03:55 PM.
-
Oct 20th, 2009, 03:57 PM
#8
Re: extracting specific text from loaded html source
Regex can certainly do what you need. Give it a try and come back here if you have a problem.
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
-
Oct 20th, 2009, 03:58 PM
#9
Re: extracting specific text from loaded html source
Hey,
Regular Expressions are essentially pattern matches.
You tell it which pattern you want to look for, and it will do it's best to find that pattern in the string you give it.
For instance, in the example that you provide, you would want to search for something like:
This basically says, find anything, that lives between the closing > of an anchor tag and the closing element of an anchor tag, in your case, Regional CRA II. The same could then be applied for the second part:
Which would give you the second part you are interested in.
These are very crude examples, and would likely result in more matches than you actually wanted, but hopefully they will illustrate what can be done.
Regular Expressions is a big topic, so I would recommend that you go and read up some on it, using the links in my signature, then download RegexBuddy, and start trying to create some Regular Expressions, and then integrate them into your application.
Gary
-
Oct 20th, 2009, 05:35 PM
#10
Thread Starter
New Member
Re: extracting specific text from loaded html source
Is there any way you could make me a little snippet that works? Im really struggling to visualize this.
-
Oct 21st, 2009, 01:28 AM
#11
Re: extracting specific text from loaded html source
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|