Graphic Design Forum and Web Design Forum  

Go Back   Graphic Design Forum and Web Design Forum »Web Design Forum »Programming Forum

Notices

Programming Forum Web and Software Programming Forum - Java, PHP, SQL etc.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-05-2008, 07:56 PM
Joe.Morgan's Avatar
The Super Chicken Mod
 
Join Date: Jan 2007
Location: West London
Posts: 639
Default Help with XMl, HTML and Javascript

Dear Estetica forum members,

Unfortunately I dont get much time to come on these forums these days but I am hoping someone wouldn't mind sparing a few minutes of their time to look over something for me?

I am trying to load an XML document into an HTML document using javascript and style it using CSS. I have managed to style the XML file using an XSLT doc but now wish to try with javascript and CSS. Can any body help?

I have attached the XML file along with a rather poor drawing of what I will try and accomplish with the CSS:

www.bekids.co.uk/joe/cssidea.jpg
www.bekids.co.uk/joe/oil.xml

If any body could help, it would be most appreciated

Hope everyone is keeping well.

Joe
Attached Images
File Type: jpg blah.jpg (52.9 KB, 11 views)
__________________
Joe Morgan
.Be Kids - Live Strong

Last edited by Joe.Morgan; 10-05-2008 at 08:53 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #2 (permalink)  
Old 10-05-2008, 09:01 PM
zumojuice's Avatar
Experimental Member
 
Join Date: Feb 2007
Location: York
Posts: 2,296
Default

joe - there you are buddy, how are you?
__________________
Richard Gray - Graphic Designer
http://www.zumojuice.me.uk
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #3 (permalink)  
Old 10-05-2008, 09:09 PM
Joe.Morgan's Avatar
The Super Chicken Mod
 
Join Date: Jan 2007
Location: West London
Posts: 639
Default

very well thank you zumo. Long time no speak. Been a busy bee in my neck of the woods. Anything new with you?
__________________
Joe Morgan
.Be Kids - Live Strong
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #4 (permalink)  
Old 11-05-2008, 11:20 AM
Joe.Morgan's Avatar
The Super Chicken Mod
 
Join Date: Jan 2007
Location: West London
Posts: 639
Default

I have search for hours on the net in regards to putting XML in HTML with javascript but no where does it explain it very clearly - or I am not getting the jist of it. even w3c schools is becoming very confusing. I have managed to put XML into flash this morning just the javascript I am struggling with
__________________
Joe Morgan
.Be Kids - Live Strong
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #5 (permalink)  
Old 11-05-2008, 12:11 PM
tommylogic's Avatar
Markup Validation Nazi
 
Join Date: Apr 2007
Location: USA
Posts: 3,538
Default

Mack is the king of the Flash department... PM him, I'm sure he'll point you in the right direction.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #6 (permalink)  
Old 11-05-2008, 12:13 PM
Toon's Avatar
Netvibes is an Addiction™
 
Join Date: Jan 2007
Location: Sheffield, UK
Posts: 15,728
Default

Quote:
I am trying to load an XML document into an HTML document using javascript and style it using CSS
Flash is not required
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #7 (permalink)  
Old 11-05-2008, 01:14 PM
Joe.Morgan's Avatar
The Super Chicken Mod
 
Join Date: Jan 2007
Location: West London
Posts: 639
Default

Sorry Toon, my mistake - I meant I have learnt how to put XML into flash, just struggling to put XML into HTML =)

Thank tommy - ill PM Mack
__________________
Joe Morgan
.Be Kids - Live Strong
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #8 (permalink)  
Old 11-05-2008, 03:25 PM
Joe.Morgan's Avatar
The Super Chicken Mod
 
Join Date: Jan 2007
Location: West London
Posts: 639
Default

Work in progress - it doesn't work tho

PHP Code:
<html>
<
body>

<
script type="text/javascript">
var 
xmlDoc=null;
if (
window.ActiveXObject)
{
// code for IE
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
else if (
document.implementation.createDocument)
{
// code for Mozilla, Firefox, Opera, etc.
xmlDoc=document.implementation.createDocument("","",null);
}
else
{
alert('Your browser cannot handle this script');
}
if (
xmlDoc!=null)
{
xmlDoc.async=false;
xmlDoc.load("oil.xml");

document.write("<table border='1'>");

var 
x=xmlDoc.getElementsByTagName("oil");
for (
i=0;i<x.length;i++)

document.write("<tr>");
document.write("<td>");
document.write(
x[i].getElementsByTagName("oil")[0].childNodes[0].nodeValue);
document.write("</td>");

document.write("<td>");
document.write(
x[i].getElementsByTagName("desc")[0].childNodes[0].nodeValue);
document.write("</td>");
document.write("</tr>");
}
document.write("</table>");
}
</script>

</body>
</html> 
__________________
Joe Morgan
.Be Kids - Live Strong
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #9 (permalink)  
Old 11-05-2008, 05:34 PM
LeadMagnet's Avatar
Mr. Tambourine Man
 
Join Date: Jun 2007
Location: Ireland
Posts: 1,085
Default

I'm not really up on my xml, but i think your problem is here:
Code:
x[i].getElementsByTagName("oil")[0].childNodes[0].nodeValue);
you're repeating yourself there by typing x[i].getElementsByTagName("oil")[0]
You've already defined x as being xmlDoc.getElementsByTagName("oil") so that means you're writing:
xmlDoc.getElementsByTagName("oil").getElementsByTagName("oil")[0]. So that's going to fail straight off the bat.

It's not a huge deal for just getting things working, but for validation purposes, avoid using document.write

Take a look at the code here on this page and it should set you on the right path. You'll notice it uses document.createElement and document.createTextNode instead of document.write. That's the proper DOM way to do it.

JavaScript - Import XML Document
__________________
Subtlety is my middle name... and first and last in case you didn't get the point.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #10 (permalink)  
Old 11-05-2008, 05:56 PM
Joe.Morgan's Avatar
The Super Chicken Mod
 
Join Date: Jan 2007
Location: West London
Posts: 639
Default

I did look at that tutorial but even using his script with his XML file doesn't work
__________________
Joe Morgan
.Be Kids - Live Strong
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
Reply


Thread Tools
Display Modes

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 On
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript Mario jinny Games 2 02-05-2008 05:56 PM
Javascript SmoothGallery 2.0 Graphic Design Links Graphic Design Links 0 24-01-2008 12:10 PM
Yahoo & Javascript Toon General Web Design Forum 0 12-12-2007 08:05 PM
my javascript website solidgold Web Design Forum Showcase 5 12-06-2007 06:24 PM
New Javascript Menu Toon General Web Design Forum 1 26-03-2007 01:31 PM


All times are GMT. The time now is 09:57 AM.



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC5