image
image

Go Back   macosx.com > Design, Media, Programming & Scripting > Software Programming & Web Scripting

Reply
 
LinkBack Thread Tools
  #1  
Old May 10th, 2005, 09:29 AM
Fahrvergnuugen's Avatar
I am the law!
 
Join Date: Apr 2001
Location: Galway, NY
Posts: 1,009
Thanks: 0
Thanked 0 Times in 0 Posts
Fahrvergnuugen is on a distinguished road
Dashboard Widget + XML?

I want to write a dashboard widget that displays the last 5 posts of a web forum that I run. I've written a PHP script that runs on the server and queries the database for the information then spits out the result as XML.

Now I'm lost. I have no idea how to get my widget to load & parse the XML file that the server is generating. I have written plenty of parsers in PHP & Actionscript but never in JavaScript. I don't even know where to begin...

Unfortunately the Apple Developer page for dashboard doesn't have ANYTHING regarding XML parsing.
__________________
-Paul Wieland______________
http://www.sickdimension.com
Dual G5 2.0Ghz / 2.5GB Ram / 620 GB HD / 23" CD
Reply With Quote
  #2  
Old May 10th, 2005, 10:15 AM
Mac Metal Head
 
Join Date: Nov 2003
Posts: 821
Thanks: 0
Thanked 0 Times in 0 Posts
HateEternal is on a distinguished road
From what I understand the widget JavaScript is different than normal web JavaScript but in Web standard JavaScript you can do a obj.getElementsByTagName(sName) which will return an array of tag objects.
Reply With Quote
  #3  
Old May 10th, 2005, 10:45 AM
Fahrvergnuugen's Avatar
I am the law!
 
Join Date: Apr 2001
Location: Galway, NY
Posts: 1,009
Thanks: 0
Thanked 0 Times in 0 Posts
Fahrvergnuugen is on a distinguished road
thanks, that looks like it should do the trick.
To get started though, how would you load the XML into an object?
__________________
-Paul Wieland______________
http://www.sickdimension.com
Dual G5 2.0Ghz / 2.5GB Ram / 620 GB HD / 23" CD
Reply With Quote
  #4  
Old May 10th, 2005, 12:01 PM
Mac Metal Head
 
Join Date: Nov 2003
Posts: 821
Thanks: 0
Thanked 0 Times in 0 Posts
HateEternal is on a distinguished road
You could try using XMLHttpRequest

Code:
 
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "test.txt",true);
 xmlhttp.onreadystatechange=function() {
  if (xmlhttp.readyState==4) {
   alert(xmlhttp.responseText)
  }
 }
 xmlhttp.send(null)
I got the example from here: http://jibbering.com/2002/4/httprequest.html
Reply With Quote
  #5  
Old May 10th, 2005, 01:03 PM
Fahrvergnuugen's Avatar
I am the law!
 
Join Date: Apr 2001
Location: Galway, NY
Posts: 1,009
Thanks: 0
Thanked 0 Times in 0 Posts
Fahrvergnuugen is on a distinguished road
Yes, excellent!
Thank you very much.
__________________
-Paul Wieland______________
http://www.sickdimension.com
Dual G5 2.0Ghz / 2.5GB Ram / 620 GB HD / 23" CD
Reply With Quote
Reply

Bookmarks

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Apple Dashboard Widget Contest fryke Mac OS X System & Mac Software 0 November 6th, 2004 05:51 AM
XML and Flash twister Design & Media 7 October 21st, 2003 06:41 PM
Thank God the Witch Is Dead Veljo Mac OS X System & Mac Software 2 June 27th, 2003 06:51 PM


All times are GMT -5. The time now is 05:11 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC1
Copyright 2000-2010 DigitalCrowd, Inc.