Hey, I have a little problem with my XML.
<family>
<parent gender="female" name="Mom" />
<parent gender="male" name="Dad" />
<children>
<child gender="male" name="Billy" />
<child gender="female" name="Janine" />
<child gender="male" name="Joe" />
</ children>
<uncle gender="male" name="Daniel" />
</ family>
And then my as goes kinda, exactly, like so.
[FONT=Courier New] [/FONT]
family_xml = new XML();
family_xml.ignoreWhite = true;
family_xml.onLoad = function(loaded) {
if (loaded) {
trace("My uncle is "+this.firstChild.childNodes[3].attributes.name+".");
} else {
trace("Could not load familyTree.xml");
}
};
family_xml.load("familyTree.xml");
So, what I’m trying to acomplish here is the satisfying output of “My uncle is Daniel.” However, I’m getting “My uncle is undefined.” Does anybody know why this happens? I would like to figure it out fast. I’m learning about XML for a pretty big project.