Forum Moderators: skibum

Message Too Old, No Replies

XML must be Parsed

         

Hova_187

1:01 am on Aug 29, 2003 (gmt 0)

10+ Year Member



Hey guys,

Sorry I'm a newbie here, and you guys are always so helpful, so I thought I would run this by you guys. I signed up for FindWhat.Com's affiliate program, and they sent me the URL for their XML interface. However, I'm not sure exactly how to incorporate this into my website. It is as follows. It says

"This URL will return raw XML data that will need to be parsed on your end and displayed in the format of your choice. "

How do I go about doing that? I didnt want to post the link. Cause I know that kinda stuff isnt appreciated. If you guys could help me out, I would be so greatful. Thanks in advance!

Joe

justageek

5:18 pm on Aug 29, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There are a couple of ways to do it. The easiest imho is to just substring the results out since their feed is a definate pattern. Of course if they change then you need to but they haven't changed in quite some time.

MrSpeed

1:52 pm on Aug 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you intend to use the xml data to dynamically build your site or use it to build static pages and then upload it?

killroy

2:10 pm on Aug 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, I run it through my XML lib and then place the data into html template code.

The "proper" way of doing it would of course be through XSLT as far as I understand.

SN

Hova_187

5:38 pm on Aug 30, 2003 (gmt 0)

10+ Year Member



It is so I can add Findwhat's search box to my website, so their results can be displayed when someone searches. Thats pretty much all I need to do, but I've never dealt with xml before (i'm new to the design world), so I dont know where to start!

aspdaddy

6:06 pm on Aug 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What scripting language is available on your server?

In ASP you can use the XMLHTTP object and the selectNodes & selectSingleNode to get the data you want out. There are free scripts to do this but you will need to modify them. You might even get an example template/script from the data provider.

Hova_187

2:10 pm on Aug 31, 2003 (gmt 0)

10+ Year Member



This is what is says in my Cpanel

PHP Version 4.3.2
Mysql Version 3.23.56
Apache Version 1.3.28 (Unix)
Operating System Linux
Perl Version 5.006001

I dont know if that is what you mean, like I said. I'm new. Is this something a newbie can do? I can grasp programmin stuffin pretty easily, this is just foreign territory. Thanks a bunch man!

Joel

Hova_187

2:14 pm on Aug 31, 2003 (gmt 0)

10+ Year Member



ASPDaddy,

I can also show you the URL for the XML interface, just so you can see it, if you want, let me know... THanks again man. Have a good weekend!

Joel

MonkeeSage

2:50 pm on Aug 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



XML is very easy to parse. In simplest case the file is just:

<somerootelement>
<children>blah</children>
<children>blah</children>
<children>blah</children>
<children>blah</children>
</somerootelement>

If it is simple enough (e.g., like the example above), then you can just use Perl / PHP / or even client side JS to parse it. Just map out <somerootelement> -> <div> , <children> -> <span> or similar then write your converted element to the HTML document.

If the XML tree is more complex it might be worth the effort to learn XSLTs and map out the elements with XPath, especially if you are good at learning programming type stuff pretty easily.

There are lots of good tutorials on XSL / XPath online (check out xml.com "essentials" for starters). I just started learning XSL recently, kind of...more like a spare-time thing...and I've found at least 5 or 6 good tuts so far just by a search for "XSL tutorial." :)

Jordan

Hova_187

11:59 pm on Aug 31, 2003 (gmt 0)

10+ Year Member



Thanks Monkey,

They sent it to me in a URL format, I'm not sure what to do with it. Any ideas?

aspdaddy

6:49 pm on Sep 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Check the script I sent, its not for FindWhat but I think its identical apart from the URL of the data and the affilliate ID.