Tally List : mailing list management, archiving, and analysis
click for archive home
 
Archive of:
CF-Talk
Cold Fusion - Technical
 
home
24 hour view
quick stats
weekly updates
 
all tallylists
corporate solutions
archive your favorite
help / feedback


Search the Tallylist search by keyword:

About Cold Fusion :
product's home
product's list home
 
  Archived TallyList / CF-Talk: 
Subject: Re: Parsing??
pan (37p/+2r)     Posted: Saturday 16 Dec 2000
This post: 251 views, +1 rating

> I have successfully used the cfhttp tag to pull a webpage and then display > it with CFHTTP.FileContent. But how do I just display specific parts? > > Rich

Craig already showed you one method.

Basic info is that cfhttp.filecontent is one_big_string. You use the various cf string functions to extract what you want from one_big_string. Regular expressions help a lot (see function list in docs). When you grab a web page's content with cfhttp all the content is stored in the variable cfhttp.filecontent. If you need to extract more than one item from one_big_string, you might want to copy one_big_string to additional variables - one variable for each extraction. That keeps you from having to refresh cfhttp.filecontent.

Thus,

<cfset tmp1=cfhttp.filecontent> ..... do extractions ..... ending with content_1 you want to use

<cfset tmp2=cfhttp.filecontent> .... do extractions ..... ending with cntent_2 you want to use

repeat

The simplest extraction method is using the mid() function. If the web page is static, never changes and you count the char positions to set the attritbutes of mid(), then you need to do nothing more.

A little more complex is using Find() to set the beginning and end values of mid(). If the web page is dynamic, but the info you want always begins with a specific char sequence and ends with a specific char sequence, then you can use Find() or FindNoCase() to determine where to begin and end your mid() extraction.

In some cases you can use the suite of List functions to do your extractions. In particular when the cfhttp.filecontent is a collection of well formed sentences you can use chr(32),chr(10),chr(13) as a list delimiters and go from there. I would classify this as a technique for a special case.

Better methods involve using regular expression via the REFind(),REFindNoCase(),REReplace(), and REReplaceNoCase() functions along with several other string manipulation functions and techniques.

Beyond string manipulation wddx and xml can be your solution.

Beyond common packet formation and trasmission formats (like xml, wddx) there is AI based pattern recognition and cognitive artificial ideation, but for all practical purposes this amounts to nothing more than employing an esp() function :) . Pan


Similar Subject Line Posts (+/- two weeks of this post)
RE: Parsing??  18 Dec 2000   (114 v/ +0 r)
RE: Parsing??  18 Dec 2000   (97 v/ +0 r)
RE: Parsing??  16 Dec 2000   (90 v/ +0 r)
Re: Parsing??  16 Dec 2000   (93 v/ +0 r)
Re: Parsing??  16 Dec 2000   (110 v/ +0 r)
Re: Parsing??  16 Dec 2000 (this post)   (251 v/ +1 r)
RE: Parsing??  16 Dec 2000   (88 v/ +0 r)
RE: Parsing??  16 Dec 2000   (96 v/ +0 r)
RE: Parsing??  16 Dec 2000   (98 v/ +0 r)
RE: Parsing??  16 Dec 2000   (89 v/ +0 r)
Parsing??  16 Dec 2000   (97 v/ +0 r)
 

Send a reply to the CF-Talk list!
click to send a reply! NOTE: Many lists will reject your post unless you have already registered with them. Also - don't forget the right account to send from (for those with multiple emails!)

Feedback: If this post was exceptionally helpful, please help by giving this post a positive review.

 

TallyList : copyright Ububik - 2000