homepage Welcome to WebmasterWorld Guest from 23.20.220.79
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / RSS, ATOM, and Related Technologies
Forum Library, Charter, Moderators: bill & werty

RSS, ATOM, and Related Technologies Forum

    
Beginners guide to using an XML feed
kapow




msg:1543441
 1:25 pm on Apr 13, 2004 (gmt 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...).

 

lorax




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

Start here: [xml.com...]

davidpbrown




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

also [w3schools.com ]

jeffbarr




msg:1543444
 8:32 pm on Apr 24, 2004 (gmt 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

somerset




msg:1543445
 8:16 pm on May 8, 2004 (gmt 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.

Dreamquick




msg:1543446
 9:05 pm on May 8, 2004 (gmt 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

sidyadav




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

[promotiondata.com...]

Sid

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / RSS, ATOM, and Related Technologies
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved