PowWeb Forums - The Perfect Community for the Perfect Host  

Register now to interact with over 11,000 members! Registered users have Posting Privileges, free access to Private Messaging, Email Notifications and more.

Go Back   PowWeb Community Forums > Web Site Design > HTML/CSS/Javascript
User Name
Password
Register FAQ Members List Search Today's Posts Mark Forums Read

Closed Thread
 
Thread Tools
Old 1-22-05, 04:42 AM   #1
desifusion
Guest
 
Posts: n/a
XML Problem - Any XML Guru here?

A software i use to play songs at my radio station generates xml files such as the one below on its own. It is supposed to be usable to create webpage with updating ticker to display the contents of that xml file as they update constantly. I tried reading tutorials/manuals, but no avail. Please help!!!

<Schedule System="Jazler">
<Event status="happening" startTime="02:08:20" eventType="song">
<Announcement Display="Now On Air:"/>
<Song title="S000021">
<Artist name="">
<Media runTime="229.0864"/>
<Expire Time="02:12:09"/>
</Artist>
</Song>
</Event>
</Schedule>

Thanks in advance.
 
Old 1-23-05, 08:49 AM   #2
det1smc
Guest
 
Posts: n/a
You might want to see if Jazler has a script for this....

Parsing the xml file is pretty easy:
(this code is straight from the php site )
PHP Code:
if (file_exists('test.xml')) {
   
$xml simplexml_load_file('test.xml');
    
var_dump($xml);
} else {
   exit(
'Failed to open test.xml.');

So now you have the xml in a php object so you can use it like:
PHP Code:
echo 'Now Playing:' $xml->song['title']; 
Finally, you will need to update the song info... I would recomend using a frame or iframe, that way you could refresh the songe info without reloading your media player.
PHP Code:
$timeout=$xml->Media['runTime'];
//you will need to convert 4timeout to milliseconds.
echo '<script> 
             setTimeout("window.navigate(\'your_page.php\');",' 
$timeout ');
        </script>'

There are of course many other ways to this, but this should get you started.

Shawn
 
Old 1-23-05, 09:25 AM   #3
det1smc
Guest
 
Posts: n/a
a note about the previous my post

PHP? Oops. I forgot i wasn't in the php forum. You can also parse xml in javascript, however different browsers makes that method "tricky". I can give you some examples if you want, but i don't recomend it (php is easier ).

Actually, if you want to use javascript, check out this link:
http://www.nczonline.net/media/zips/...DOMWrapper.zip
It is a wrapper to handle most of the crossbrowser issues for you.
 
Old 1-31-05, 02:07 PM   #4
mfrazer
Guest
 
Posts: n/a
If you want to do it without learning PHP or figuring out how to do XML with Javascript, you would want to use XSL/XSLT. You can find a ton of easy-to-follow at DevShed's XML section or in various sections at the Web Developer's Virtual Library. There are also a lot of other places to find info, or you can just go pick up a book at your local bookstore. Basically, the XML file you listed above shows the data; the XSL file you would need to create would determine how that XML is formatted/displayed. Unfortunately, the topic is far too involved to discuss here. Good luck!
 
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:27 AM.


Contents ©PowWeb, Inc. ~ vBulletin, Copyright © 2000-2007 Jelsoft Enterprises Limited.