Welcome to WebmasterWorld Guest from

Forum Moderators: httpwebwitch

Message Too Old, No Replies

What is the best way to display data in an XML data feed?

12:29 am on Nov 15, 2009 (gmt 0)

New User

5+ Year Member

joined:Nov 15, 2009
posts: 1
votes: 0

Hi, I just recently joined webmasterworld.com but have been viewing the forums for the past few years and I need some advice from the XML experts.

I am in the process of creating an online store, all of my products & product information is already stored in a huge XML file with over 500 products. I have been researching the best way to categorize and display the products in an html page.

To be more precise I need to have navigation links to groups of products, for example if a customer clicks "Alltell Wireless" it will only show the products with the tag

<CarrierDescription>Alltel Wireless</CarrierDescription>
Also I need to have individual pages for each of the 500 products.

here is an expert from the XML feed I will be using, note that this XML feed is being updated daily with new products.

<CarrierDescription>Alltel Wireless</CarrierDescription>
<ManufacturerCode>Pearl 8130 White</ManufacturerCode>
<EquipmentName>BlackBerry Pearl 8130 White</EquipmentName>
<EquipmentShortDescription> </EquipmentShortDescription>

The BlackBerry Pearl 8130 - a super-slim, ultra-light smartphone - is now available for Alltel customers in a crisp white shell. Like all BlackBerry devices, the BlackBerry Pearl 8130 provides a top notch on-the-go email solution for mobile professionals. But the BlackBerry Pearl 8130 also includes a good camera, a built-in music player, and broadband download speed for Web browsing. Best of all, this BlackBerry weighs in at a scant 3.2 ounces and is razor-thin - the smallest of its class.
<PriceAfterRebate>You make $100.00</PriceAfterRebate>
<RebateDescription>0.00 Mail-in<br>100.00 Mail-in</RebateDescription>

<PurchaseMode>New Contract</PurchaseMode>



My question is what scripting language would be best for this task?
-PHP using DOM & SimpleXML I am most experienced and comfortable with PHP but is this task to large and complicated for PHP to handle?
-XSLT do I have to load up the entire XML file in order to display only parts of it using XSLT? if so this would not be realistic because of loading time.
-JAVASCRIPT is this the best option for what im looking to accomplish?
-ASP I am not at all familiar with ASP but if it's the best choice I will learn

I am willing to study and learn a new language if required, I am most experienced in PHP.

Can some of the true experts please give me some guidance on how to implement this XML data feed into my website? thanks.

4:31 am on Nov 15, 2009 (gmt 0)

Moderator This Forum from CA 

WebmasterWorld Administrator httpwebwitch is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 29, 2003
votes: 0

question 1: yes, PHP is a good choice for this.

question 2: yes, XSLT would need to load the entire XML file. If your XML is huge, you're right that's not a great solution.

question 3: JavaScript -- don't even go there :) JavaScript is capable of parsing XML, but it's not a good idea. Because JavaScript is executed in the client's browser, you'd have to send the entire XML to the browser, which makes it even worse than option #2

ASP is really no different than PHP. XSLT transformation is a little faster in ASP C#.NET, only if the stylesheet is compiled... but for selecting nodes with XPATH they're pretty much equivalent. Since you're more comfortable with PHP, that sounds like the best path for you.

You might want to consider using a relational database rather than an XML file. If you're receiving the data as XML, you can write a script that parses it and updates your database. It's a bit more work, but I'll guarantee SQL will find products faster than a complex XPATH expression.

Welcome to WebmasterWorld!