Welcome to WebmasterWorld Guest from 54.144.107.83

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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 21, 2001
posts:1281
votes: 0


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)

Senior Member from US 

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

joined:Mar 31, 2002
posts:7575
votes: 0


Start here: [xml.com...]
2:11 pm on Apr 15, 2004 (gmt 0)

Full Member

10+ Year Member

joined:May 27, 2003
posts:242
votes: 0

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

New User

10+ Year Member

joined:Apr 13, 2004
posts:4
votes: 0


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)

Junior Member

10+ Year Member

joined:Dec 13, 2003
posts:101
votes: 0


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.

<html>
<body>
<xml id="cdcat" src="http://www.w3schools.com/xml/cd_catalog.xml"></xml>
<table border="1" datasrc="#cdcat">
<tr>
<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>
</tr>
</table>
</body>
</html>

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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 25, 2002
posts:872
votes: 0


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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 11, 2003
posts:955
votes: 0

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members