 |

09-23-2004, 03:16 PM
|
|
WebProWorld Pro
|
|
Join Date: Aug 2004
Location: Maryland
Posts: 219
|
|
XML & HTML
Does anyone know how to get an html page to display data from an xml file?
|

09-23-2004, 06:07 PM
|
 |
WebProWorld 1,000+ Club
|
|
Join Date: Jul 2003
Location: UK
Posts: 2,803
|
|
XML files with XSLT formatting
Internet Explorer 6 does display XML files, but on its own, it doesn't have the ability to present fully formatted pages.
If you add an XSLT stylesheet into the equation you will see the data held in the XML file displayed in a more conventional manner.
Check out the examples below:
The XML
The XSLT stylesheet
The XML file with an XSLT stylesheet
The XML file with a tree view stylesheet
Paul
|

09-23-2004, 07:19 PM
|
 |
WebProWorld 1,000+ Club
|
|
Join Date: Aug 2003
Location: Edmonton, AB, Canada
Posts: 3,406
|
|
Are we talking 'data islands'?
__________________
What I am is what I am, are you what you are, or what.
Eddie Brickel
|

09-23-2004, 07:22 PM
|
 |
WebProWorld 1,000+ Club
|
|
Join Date: Aug 2003
Location: Edmonton, AB, Canada
Posts: 3,406
|
|
Also, you can use javascript to pull data, as well as php. Just parsing through at the moment, but if you want, we can get more info.
__________________
What I am is what I am, are you what you are, or what.
Eddie Brickel
|

09-24-2004, 10:28 AM
|
|
WebProWorld Pro
|
|
Join Date: Aug 2004
Location: Maryland
Posts: 219
|
|
Display XML data
I have an xml rss feed that I have the xml source for, but I don't know how to get it to "feed". I have performed 10-20 searches on the net to try to find some code, but I can't find anything.
My server has the ability for MySQL, PHP, ASP, CF & PERL.
|

09-24-2004, 01:12 PM
|
|
WebProWorld New Member
|
|
Join Date: Oct 2003
Location: Delaware, US
Posts: 13
|
|
RSS Parser
You might want to look at http://magpierss.sourceforge.net/. This is a PHP class that will let you display the code from all RSS versions including Atom. Free and effective.
|

09-24-2004, 01:15 PM
|
 |
WebProWorld 1,000+ Club
|
|
Join Date: Jul 2003
Location: UK
Posts: 2,803
|
|
Parsing XML files to produce HTML
Quote:
|
Originally Posted by webmasterjunkie
I have an xml rss feed that I have the xml source for, but I don't know how to get it to "feed". I have performed 10-20 searches on the net to try to find some code, but I can't find anything.
My server has the ability for MySQL, PHP, ASP, CF & PERL.
|
For that you'll need some means of parsing the XML files before they can be displayed as HTML. You can use any of the above server side programming languages you've listed. The actual implementation varies according to the choice of language/programming environment. If you check out the Programming Resources you'll see links to RSS parsers. One of the better ones is the MagpieRSS parser and that uses PHP. Microsoft have their own MSXML component that can be used in conjunction with ASP (if you need specific code for an ASP script I can help). There are many more out there.. just Google for " RSS parsers".
Paul
|

09-24-2004, 01:35 PM
|
|
WebProWorld New Member
|
|
Join Date: Sep 2004
Location: Cambridge
Posts: 1
|
|
turning XML into HTML
XSLT is a great way of turning XML into HTML.
The problem is that you need to write some code to do the translation.
If you are using IIS as your webserver, it might be worth looking at Gnomon ( http://gnomon.npsl.co.uk). It's Open source (so free), and provides a very neat way to apply XSLT to XML and send HTML back to the browser. XSLT is easy to learn and very flexible for this kind of work.
|

09-24-2004, 02:46 PM
|
|
WebProWorld New Member
|
|
Join Date: Oct 2003
Location: Delaware, US
Posts: 13
|
|
turning XML into HTML
XSLT files are great, but with an RSS feed, how do you handle the HTML that may be contained in <description> elements. My experiences is that and XML RSS feed using XSLT will render an HTML page with raw HTML code displayed. If there's something that can be done with an XSLT to allow the HTML to come through as well, then you've sold me!
|

09-24-2004, 04:06 PM
|
|
WebProWorld Pro
|
|
Join Date: Aug 2004
Location: Maryland
Posts: 219
|
|
Code Snippets
I really like that magpierss site. I spent a little over an hour there. I just don't see why site don't give you the whole code, just those darn little snippets. AAHHH!
I guess why give away all of your hard work. Anyway, maybe I should be a little more clear, my username should be "webjunkie" as opposed to "web'master'junkie". I need to see some code of a page to see how it was done. Does that make sence?
|

09-24-2004, 05:13 PM
|
|
WebProWorld New Member
|
|
Join Date: Oct 2003
Location: Delaware, US
Posts: 13
|
|
With Magpie:
PHP Code:
Code:
<?php
define('MAGPIE_DIR', '/path/classes/magpie/');
//define('MAGPIE_CACHE_ON', 0);
require_once(MAGPIE_DIR.'rss_fetch.inc');
$url = $_GET['url'];
if ( $url ) {
$rss = fetch_rss( $url );
if($rss)
{
echo "<HTML>";
echo "<link rel='Shortcut Icon' href='/images/qrotatoricon.gif'>";
echo "<link rel='stylesheet' type='text/css' href='/summary.css' />";
echo "<body leftmargin='15'><table width='90%' cellspacing='0' cellpadding='0' border='0' align='left'><tr><td width='100%'>";
echo '<div class="channelname"><a href=';
echo '"';
echo $rss->channel['link'];
echo '">' . $rss->channel['title'] . '</a></div>';
echo "<ul>";
foreach ($rss->items as $item) {
$href = $item['link'];
$title = $item['title'];
echo "[*]<a href=$href>$title</a>
".$item['description']."
";
}
echo "[/list]";
}
else
{
echo "<HTML>";
echo "<link rel='stylesheet' type='text/css' href='/summary.css' />";
echo "<body leftmargin='15'><table width='90%' cellspacing='0' cellpadding='0' border='0' align='left'><tr><td width='100%'>";
echo '
RSS Feed Currently Unavailable. Try refreshing your browser (at least twice). Contact QSupport if this problem continues</p>';
}
}
}
?>
</td></tr></table></body></html>
The you reference it with http://yourdomain/yourphpfile.php?ur...ourrssfeed.xml
|

09-27-2004, 12:43 PM
|
 |
WebProWorld Veteran
|
|
Join Date: Sep 2004
Location: Wisconsin, United States
Posts: 439
|
|
RSS to Javascript
I've worked with RSS feeds on my site a bit....
Visit RSS to JavaScript
I'm not a programmer so I may be completely irrelavant here, but if you don't want to worry about PHP this works well & it's FREE. You can slot it right into your HTML.
A PHP version would be better...
__________________
Matt Levenhagen
Campaign Blasts - Affiliate Marketing & Adwords Training
Blaster's eZine - An Adwords & Affiliate Marketing Publication
|

09-30-2004, 09:54 AM
|
|
WebProWorld New Member
|
|
Join Date: Sep 2004
Posts: 7
|
|
Displaying RSS
Hi,
The following sites and tools will help webmasters generate java or html that can be used to display content in rss feeds:
http://www.rss-specifications.com/display-rss.htm
HTH
|

09-30-2004, 10:10 AM
|
 |
WebProWorld 1,000+ Club
|
|
Join Date: Jul 2003
Location: UK
Posts: 2,803
|
|
Nice find!
Excellent resource Sharon!
I've added it to the recommended RSS links in " Programming Resources"
Paul
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|