18Aug/090
Basic XML checking…
Lots of unexpected errors can come from mistyping XML. So you have wrong data, and you load it to your program and of course it will work wrong.
You can be sure to check your loaded data before doing anything. Also be sure to cast your data when assigning it to variable. In example:
//Sample XML var xml:XML = <node attribute="1">Node text</node>; //Assign node text to txt variable var txt:String = null; if ( "node" in xml ) { txt = String( xml.node ); } else { trace( "Node doesn't exist!" ); } //Assign node attribute to num variable var num:uint = 0; if ( "@attribute" in xml ) { num = uint( xml.@attribute ); } else { trace( "Attribute doesn't exist!" ); }