Welcome to WebmasterWorld Guest from

Forum Moderators: bill & werty

Message Too Old, No Replies

Beginners guide to using an XML feed



1:25 pm on Apr 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

A big data supplier provide an XML feed that we may use, but I know very little about XML. The data feed has info like: items available, item costs, and confirmation of purchase when an order goes through...

How do I get started learning how XML is received from a data source (another website), displayed on our site, etc?

Its the sending and receiving of the info between the supplier's site and mine that is my main enquiry.

(I'm using apache, php, mysql...).


2:05 pm on Apr 15, 2004 (gmt 0)

WebmasterWorld Senior Member lorax is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

Start here: [xml.com...]


2:11 pm on Apr 15, 2004 (gmt 0)


8:32 pm on Apr 24, 2004 (gmt 0)

10+ Year Member

If you are concerned about fetching the XML from the remote site, you should take a look at PHP's file() function ([us2.php.net ]) and the Curl library ([us2.php.net ]). The file() function is good if you aren't doing anything overly complex in the fetch. Curl is a lot more general.

For parsing, you can use PHP's implementation of the expat parser ([us2.php.net ]).

The basic model that you will follow is:

1 - Fetch the XML data
2 - Parse it
3 - Store it in your database
4 - Act on the stored data


8:16 pm on May 8, 2004 (gmt 0)

10+ Year Member

Here is a simple bare bones xml call to display any external xml file in your html file, just save as whatever you want .html.

<xml id="cdcat" src="http://www.w3schools.com/xml/cd_catalog.xml"></xml>
<table border="1" datasrc="#cdcat">
<td><span datafld="ARTIST"></span></td>
<td><span datafld="TITLE"></span></td>
<td><span datafld="COUNTRY"></span></td>
<td><span datafld="COMPANY"></span></td>
<td><span datafld="PRICE"></span></td>
<td>year: <span datafld="YEAR"></span></td>

Change the 'xml id' to whatever is the absolute url for the xml file (and change the datafld accordingly). Easy, but no go in Mozilla.


9:05 pm on May 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Easy, but no go in Mozilla.

Or Opera for that matter - in other words it's IE only.

To really the most "bang for your buck" out of an XML or RSS feed for web-based applications you need to be parsing it at the server-side and outputting it to the page.

At a push you could use XML+XSL, but even then you can't always rely on the older browsers to render it.

- Tony


5:19 am on May 9, 2004 (gmt 0)

Featured Threads

Hot Threads This Week

Hot Threads This Month