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.
ColdFusion LanguageXMLWeb Languages and Standards

Avatar of undefined
Last Comment
_agx_
ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of _agx_
_agx_
Flag of United States of America image

>> 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>
Avatar of _agx_
_agx_
Flag of United States of America image

>> 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 :)
Web Languages and Standards
Web Languages and Standards

Web development can range from developing the simplest static single page of plain text to the most complex web-based internet applications, electronic businesses, and social network services using a wide variety of languages and standards, including the familiar HTML, JavaScript and jQuery, ASP and ASP.NET, PHP, ColdFusion, CSS, PHP, Flex and Flash, but also the implementation of a broad list of standards including XML, WSDL, SSDL, VoiceXML and many more.

40K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo