# Getting all children of XML node

**URL:** <https://forum.kirupa.com/t/getting-all-children-of-xml-node/235751>\
**Category:** flash\
**Created:** [August 14, 2007, 1:37pm UTC](https://forum.kirupa.com/t/getting-all-children-of-xml-node/235751 "2007-08-14T13:37:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Capiright](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@Capiright](https://forum.kirupa.com/u/Capiright)\
**Post date:** [August 14, 2007, 1:37pm UTC](https://forum.kirupa.com/t/getting-all-children-of-xml-node/235751/1 "2007-08-14T13:37:53Z")

</div>

hey,

I got some old XMLs where the single nodes are not closed with /tag:

\<tag attrib=“1” /\>  
as oppose to  
\<tag attrib=“2” \>\</tag\>

now i did the little following code  
\_xmlData = new XML();  
\_xmlData = \<test name=“root”\>  
\<item name=“item1” /\>  
\<item name=“item2”\>\<sub name=“sub1” type=“dead”/\>\</item\>  
\<item name=“item3” /\>  
\<item name=“item4”\>\<sub name=“sub1”/\>\</item\>  
\</test\>;  
\_xmlCurrentSelection = new XMLList();  
\_xmlCurrentSelection = \_xmlData.descendants(“item”);  
for each( var item:XML in \_xmlCurrentSelection)  
trace("item: "+item);

where xmlCurrentSelection is XMLList, now the output is :

item:  
item: \<item name=“item2”\>  
\<sub name=“sub1” type=“dead”/\>  
\</item\>  
item:  
item: \<item name=“item4”\>  
\<sub name=“sub1”/\>  
\</item\>

notice that item1 and item3 are not printed out - i wonder why?  
i am used to \<tag /\> and \<tag\>\</tag\> being the same (or at least feeling very much the same).  
any idea on how to reach those objects?
