The following is example of reading XML with ActionScript 3
var xml:XML =
<content>
<a>Hello A</a>
<b>Hello B</b>
<c>
<c1>Child C1</c1>
<c2>Child C2</c2>
</c>
</content>;
trace(xml.a); // OP: Hello A
trace(xml.c.c1); // OP: Child C1
trace(xml.d); // OP: (nothing)
trace(xml.b);; // OP: Hello B
I don't see the xml.d
outputting an empty string as expected behavior? Is this normal? What is the reasoning for this?
To me, I 'feel' like I should be doing this:
if(xml.d) trace(xml.d);
Is it ok to rely on the empty string behavior? IE do I need to check for a node's existence??