XML problems... Geeze!

Hello all,

I have a simple external XML file :

<?xml version=“1.0” encoding=“iso-8859-1”?>
<nouveautes>
<nouvelle1>This is content 1</nouvelle1>
<nouvelle2>This is content 2</nouvelle2>
</nouveautes>

I have a simple loading script on a key frame :

news = new LoadVars();
news.load(“nouvelles.xml”);
news.onLoad = function(success){
if(success){
nouvelle1 = news.firstChild;
nouvelle2 = news.nouvelle1.nextSibling;
}
else {
trace (“Error while loading file”);
}
}
stop();

On my scene, I have 2 dynamic text fields.
One called content1, the other called content2.

I want my textfield named content1 to show the content of the nouvelle1 variable (news.firstChild).
and my textfield named content2 to show the content of the nouvelle2 variable (news.nouvelle1.nextSibling).

What do I need to do?
I have tried to write “nouvelle1” in the Var field of my content1 textfield and “nouvelle2” in the Var field of my content2 textfield but this doesn’t work.

Any ideas would be appreciated.

Thanks! :}

neuhaus3000

instead of this:

news = new LoadVars();

use this:

news = new XML();
news.ignoreWhite = true;

HA HA ! :thumb:

Yes mi friend! That’s it!

Works fine now.

Thanks a million! :beam:

neuhaus3000

welcome

Hey rysolag,

I’ve changed my loading script to…

news = new XML();
news.ignoreWhite = true;
news.load(“nouvelles.xml”);
news.onLoad = function(success){
if(success){
rootNode = news.firstChild;
nouvelle1 = rootNode.firstChild;
nouvelle2 = nouvelle1.nextSibling;
}
else {
trace (“Error while loading file”);
}
}
stop();

I can see texte in my textfields called nouvelle1 and nouvelle2
but it looks like :
<nouvelle1>This is content 1</nouvelle1>
and
<nouvelle2>This is content 2</nouvelle2>

The tags are included in the content.
All I want to see are the elements from these tags…
Any ideas? I’ve read something about the attributes object
but I can’t quite understand how to use it.

Thanks! :smiley:

neuhaus3000