# XML & ChildNodes

**URL:** <https://forum.kirupa.com/t/xml-childnodes/173511>\
**Category:** flash\
**Created:** [December 26, 2005, 5:36pm UTC](https://forum.kirupa.com/t/xml-childnodes/173511 "2005-12-26T17:36:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghjr](https://avatars.discourse-cdn.com/v4/letter/g/dec6dc/32.png) [@ghjr](https://forum.kirupa.com/u/ghjr)\
**Post date:** [December 26, 2005, 5:36pm UTC](https://forum.kirupa.com/t/xml-childnodes/173511/1 "2005-12-26T17:36:34Z")

</div>

I’m running into some problems when parsing an XML file. In the first frame of my SWF I define the following “constant”:

[AS]this.addProperty(“XML\_CAMINHO\_DADOS”, function(){return “xml.firstChild.childNodes[1]”}, null);[/AS]

I then try calling it later on like this (after I load in my XML and all):

[AS]var caminhoDados:XMLNode = eval(XML\_CAMINHO\_DADOS);  
trace(caminhoDados.nodeName);[/AS]

I was suspecting that this would basically call xml.firstChild.childNodes[1].nodeName but instead it returns undefnied.

The strange thing is, it works if I don’t use childNodes in the path, like this:

```auto
this.addProperty("XML_CAMINHO_DADOS", function(){return "xml.firstChild.firstChild.nextSibling"}, null);

```

Any reason as to why using childNodes prevents me from doing what I’m trying to do?

Cheers!
