Professional Web Applications Themes

Populating an array with a list of values - Macromedia ColdFusion

I have performed a cfhttp request, the results of which are in a variable called FoundString. Found String consists of a list of website links, I want each link to be an element in an array. How do i do this? Any ideas?...

  1. #1

    Default Populating an array with a list of values

    I have performed a cfhttp request, the results of which are in a variable
    called FoundString. Found String consists of a list of website links, I want
    each link to be an element in an array. How do i do this? Any ideas?

    samb1 Guest

  2. #2

    Default Re: Populating an array with a list of values

    Try this:

    <cfset array = ListToArray(FoundString,[delimeter])
    >
    If you replace [delimeter] with the delimter you use to separate the links it should work.

    Seth Buntin Guest

  3. #3

    Default Re: Populating an array with a list of values

    Thanks for your reply but istill cant get it to work. Do you think the use of XPATH may help in this situation?
    Im not really an expert on these matters as i have only just started out with CF
    samb1 Guest

  4. #4

    Default Re: Populating an array with a list of values

    Maybe if i post u my XML and explain what im doing it might help: XML doc:
    <?xml version='1.0' encoding='iso-8859-1'?> <listings> <site
    index='http://www.rspb.org.uk/vacancies/index.asp'> <p
    name='link'
    re='&amp;lt;\s*td\s*>\s*&amp;lt;\s*A\s*(.*?)HREF\s *=\s*[&amp;quot;&amp;quot;](.*
    ?)[&amp;quot;&amp;quot;](.*?)\s*>'/> <detail-page-prs>
    <p name='title' re='&amp;lt;\s*H2>\s*(.*?)>(.*?)&amp;lt;/H2>' />
    <p name='location'
    re='&amp;lt;p[\s]id=[&amp;quot;&amp;quot;]location[&amp;quot;&amp;quot;]>(.*?)&a
    mp;lt;/p>' /> <p name='salary'
    re='&amp;lt;\s*/H3>(.*?)?\s*(.*?)\s*&amp;lt;/DIV>' /> <p
    name='hoursContactInfo' re='(full|part)[\s]time' /> <p
    name='closingDate'
    re='\s[[:digit:]][[:digit:]][[:space:]][[:print:]]+[[:digit:]][[:digit:]][[:digi
    t:]][[:digit:]]&amp;lt;br>' /> </detail-page-prs> </site>
    <site index='http://www.english-nature.org.uk/news/jobs.asp'>
    <p name='link' re='HREF\s*=\s*[''](.*?)['']'/>
    <detail-page-prs> <p name='title'
    re='&amp;lt;td\s*class=[&amp;quot;&amp;quot;]head[&amp;quot;&amp;quot;]>(.*?)&am
    p;lt;/td>' /> <p name='location' re='Based[\s]*at[\s]*[[:print:]]+'
    /> <p name='salary'
    re='?[[:digit:]][[:digit:]][[:punct:]][[:digit:]][[:digit:]][[:digit:]]' />
    <p name='hoursContactInfo' re='(full|part)-time' />
    <p name='closingDate'
    re='&amp;lt;b>[[:digit:]][[:digit:]][[:space:]][[:print:]]+[[:digit:]][[:digit:]
    ][[:digit:]][[:digit:]]' /> </detail-page-prs> </site>
    <site index='http://www.ccw.gov.uk/vacancies/index.cfm?'> <p
    name='link' re='HREF\s*=\s*[&amp;quot;&amp;quot;]/vacancies(.*?)\s*>'/>
    <detail-page-prs> <p name='title'
    re='&amp;lt;/TH>\s*&amp;lt;td>\s*[a-z](.*?)&amp;lt;/td>' />
    <p name='salary'
    re='?[0-9][0-9][^[:alnum:]][0-9][0-9][0-9][^[:alnum:]][0-9][0-9]' />
    <p name='hoursContactInfo' re='(full|part)-time' />
    <p name='closingDate'
    re='[[:digit:]][[:digit:]][[:punct:]][[:digit:]][[:digit:]][[:punct:]][[:digit:]
    ][[:digit:]][[:digit:]][[:digit:]]' /> </detail-page-prs>
    </site> </listings> I want to get the first site index value and use that
    value for a CFHTTP request. Then I want to use the next elements attribute,
    which is a regexp on the CFHTTP results. This will then give me a list of web
    links. I then want to loop over each web link with cfhttp and then use the
    detailed prs to p each page. Once each detailed pr has finished id
    like to call the next 'site index' element and start the process over.

    samb1 Guest

Similar Threads

  1. Populating a <mx:List> with XML
    By dzlmbq in forum Macromedia Flex General Discussion
    Replies: 2
    Last Post: March 5th, 10:41 AM
  2. populating a datagrid from an array
    By patliz1@juno.com in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: March 4th, 03:04 AM
  3. populating an array with a conditional
    By hoz in forum Macromedia Flash Actionscript
    Replies: 1
    Last Post: March 4th, 07:39 PM
  4. Replies: 2
    Last Post: September 11th, 07:05 PM
  5. Replies: 6
    Last Post: July 18th, 08:36 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139