Really weird XML problem

Ok, I’m new to XML with flash and I’ve looked at the tutorials and I have no clue what is going on here.

Heres part of my xml structure.


<?xml version="1.0"?>
	<guestbook>
		<entry>
			<hed headFrame="1" />
			<face faceFrame="1" />
			<hat hatFrame="1" />
			<shoe shoeFrame="1" />
			<name>Dujodu</name>
			<email>Weibmaster@dujodu.com</email>
			<website>http://www.dujodu.com/</website>
			<message>Hey this is a kind of cool guestbook you have going here.</message>
		</entry>
		<entry>
			<head headFrame="2" />
			<face faceFrame="2" />
			<hat hatFrame="2" />
			<shoe shoeFrame="2" />
			<name>Duder</name>
			<email>Webmaster@duder.net</email>
			<website>http://www.duder.net/</website>
			<message>Hey this is a kind of lameass guestbook you have going here. Keep up the crappy work.</message>
		</entry>
	</guestbook>


Ok, now I want to access the “headFrame” of the first entry, my AS would look like this, right?


hframe = my_xml.childNodes[0].childNodes[0].childNodes[0].attributes.headFrame;
trace(hframe);

That indeed should give me “1” shouldn’t it? Well I get undefined.

Through some trial and error, I found out that to get to the headFrame I need to use


hframe = my_xml.childNodes[1].childNodes[1].childNodes[1].attributes.headFrame;
trace(hframe);

which isn’t even right… so I have no clue what’s going on, but I figure that this will give me the face frame if it worked for the headFrame.


fframe = my_xml.childNodes[1].childNodes[1].childNodes[2].attributes.faceFrame;
trace(fframe);

well it doesn’t work, but guess what DOES work for the face frame


fframe = my_xml.childNodes[1].childNodes[1].childNodes[3].attributes.faceFrame;
trace(fframe);

how weird is that? So at this point I’m fed up and come to you guys for help… I hope you can make more sense of it than me…

my_xml.ignoreWhite = true;

Oh man, now I feel like a total moron

no underscore, wrong case, not even in the right spot AND a typo… I was totally looking in the wrong spot to solve this problem :sure:

Thanks for the help!

btw, can’t wait for your new XML tutorials :thumb:

Originally Posted by My_Code :lol:

it happens. I still do it all the time - both things :wink:

Definitely, I tend to forget it too. We should have it on bumper stickers or something. :wink: