var
testXml:XMLList
=
new
XMLList(
<
sectiongroup
><
a
><
section name
=
"
test
"
/></
a
></
sectiongroup
>
);
var a:XMLList = testXml[ " a " ];
trace(a);
var section:XMLList = a[ " section " ];
trace(section);
结果
var a:XMLList = testXml[ " a " ];
trace(a);
var section:XMLList = a[ " section " ];
trace(section);
Node A:
<
a
>
< section name = " test " />
</ a >
Node section:
^_^,奇怪吧,怎么section node没有被上,其实section node是选上的,不要被XML的toString方法给迷惑了。
< section name = " test " />
</ a >
Node section:
XML的toString当其有子节点时,它会显示其节点本身,当其没有子节点,只有值的时候,就只会显示值,不会显示其本身。
这理的section节点其没有子节点,只有空值,所以toString就为空字符串.