Showing posts with label XML. Show all posts
Showing posts with label XML. Show all posts

Thursday, 17 May 2012

Checking for empty xml nodes in as3

Something thats puzzled me for a bit is how to check for empty xml nodes.

so something like....

<aidanmack></aidanmack>


ok so this script isn't all there but I reckon you should get the idea.
 I would of thought doing something like this....

if(aidanmack == null){
trace("its empty")
}


or

if(aidanmack == undefined){
trace("its empty")
}

or

if(aidanmack ==""){
trace("its empty")
}

... WOULD have worked but noooo. doesn't bite at all!

Instead I've found you have to check the length!

so..

if(aidanmack.length > 0){
trace("has something in it");
}else{
trace("its empty");
}