Parsing text file with ASP

S

SROSeaner

I have a text file that is the result of using XMLHTTP object to pull back a
page of search results from a search engine.

So I have the entire results page in HTML, and want to break out each hit
result from the text file as a unique item and do what I want with each hit
result.

Is there any suggested algorithms or any other techniques I could be
directed to?
 
R

Ray Costanzo [MVP]

What exactly is a "hit result?" As far as what you want to do, it'd all
depend on what the html looks like and how consistent it remains. Do you
have control over this remote source? Or is it some other site that can
change on any given day without any forewarning?

Ray at home
 
S

SROSeaner

Actually, all I really need to do is pull out any text in the HTML text that
is a web site address, so, in the form of http://www._____.__ or starting
with www.

I think I know how to find that, by using InStr and passing it http: (for
example) as the text to look for, but, that will only give me the starting
point of the address correct?
 
R

Ray Costanzo [MVP]

Yes, that'd give you the starting point. The best you can do is have your
code make an educated guess about things when you have no idea what kind of
data will be thrown at it.

If the string contains:

<a href="http://something.com">click me</a>, should it be ignored because
there's no WWW? Should your code assume that as soon as it finds a ", then
then that is the end of the domain? What about a carriage return? What
about a < character? What about when it's in a sentence in the document,
eg.

Most Web site addresses start with http://www.

Should that be found?

There are lots of variables to deal with, and all you can really do is hope
for accuracy.

Ray at work
 
P

Patrice

You have DOM parsers available but your code will break if the architecture
of the page change. I would rather use an API or a "service" if
available....

Patrice
 
S

SROSeaner

Thanks for your help guys. I figure I will just have to code it in a way to
take care of all the variables in such a situation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top