Link to home
Start Free TrialLog in
Avatar of bradderick
bradderickFlag for Australia

asked on

XMLSearch() function - parsing xml search feed

Hi There,

I am trying to parse a 3rd party generic xml search feed in coldfusion so that I create a html output of the feed on my website.

To do this I am referencing a url that is not on my website. Let's call it http://www.externalxmlfeedurl.com

The xml file on the external url is in the following format:
<Results xsi:noNamespaceSchemaLocation="asdasd">
-
<ResultSet id="searchResults" numResults="3">
-
<Listing rank="1" title="175 <b>Hotels</b> in <b>Your Area</b>" description="Book your <b>hotel</b></b> online. Save up to 75% on your reservation." siteHost="www.destinationurlone.com/Hotels">
-
<ClickUrl type="body">
http://someurl1
</ClickUrl>
</Listing>
-
<Listing rank="2" title="<b></b> <b>Hotels</b> - Book Now" description="Up to 70% off <b></b> <b>Hotels</b>. Compare and book online now." siteHost="www.destinationurltwo.com/Hotels">
-
<ClickUrl type="body">
http://someurl2
</ClickUrl>
</Listing>
-
<Listing rank="3" title="<b></b> <b>Hotels</b>" description="Up to 75% Off in <b></b> <b>Hotels</b>. Easy Booking, Instant Confirmation" siteHost="destinationurltwo/hotels">
-
<ClickUrl type="body">
http://someurl3
</ClickUrl>
</Listing>
+
</ResultSet>
</Results>

What I am trying to do is to convert this xml data to a html output on one of my coldfusion pages
I am trying to get the output to be in the following format

Ad Title 1
Ad Description  1
Ad URL 1

Ad Title 2
Ad Description  2
Ad URL 2


Ad Title 3
Ad Description  3
Ad URL 3

I am very inexperienced using xml and the XmlSearch() and XMLParse() functions. Can you please assist me understand what I need to do to get this done.
ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>> Just like with cfml tags, "Title" and "Description" are attributes of the Listing node

ie  Rank, Title and Description are all attributes

         <Listing rank="1" title="Something ....." Description="Blah,blah ....">
         </Listing>
>> and like a structure, can be accessed with array notation  ie #structName.keyName#

Correction for the archives:
       That should be dot notation, instead of "array" notation :)