Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-15-2003, 10:29 AM   PM User | #1
wozoi
New to the CF scene

 
Join Date: Jun 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
wozoi is an unknown quantity at this point
javascript loading xml data for parameter

hi,

i'm a beginner i'm trying to access variable stored in an xml file from a javascript function embedded in a svg file. I ll repeat, i'm trying to access variable stored in an xml file from a javascript function embedded in a svg file.

and i don't wanna use an activeX controler.

I think it's possible to start like this, but it's the first time i manipulate XML so i'm a little bit inexperienced (forgive me before reading )

the xml source call sourceParam.xml :

<?xml version="1.0"?>
<varSource>
<mode> create</mode>
<todo>draw</todo>
<form>territory</form>
<envDraw>mondial</envDraw>
<drawingFrom>taiga</drawingFrom>
</varSource>

then in a initialize function of the javascript file :

getURL ("sourceParam.xml",getParam);


and the getParam function :

function getParam( data )
{
if (data.success)
{
var doc_frag = parseXML ( data.content, svgdoc);
childs=doc_frag.getChildNodes();

var mode=childs.childNodes(1).firstChild.text;
var todo=childs.childNodes(2).firstChild.text;
var form=childs.childNodes(3).firstChild.text;
var envDraw=childs.childNodes(4).firstChild.text;
var drawingForm=childs.childNodes(5).firstChild.text;
}
else {alert ("Error reading file");}
}

My objective is to instanciate the variables according to the xml file, please help me to find this solution.

thanks,

wozoi
wozoi is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 08:36 PM.


Advertisement
Log in to turn off these ads.