<name="DWG" link=""/> if link is null dont link

Trying to load in some xml stuff and caught on something. I am checking if link is null but it still attempts to fire even if no link is present.
XML:


blah..blah....
......
<name="DWG"  link=""/>
<name="ABC"  link="http://www.abc.com"/>
<name="GDW"  link="http://www.gdw.com"/>
.......

my if:


if (link != null) {
function here (
}
}

How can you escape it if there but not set? I have tried undefined, null or != ’ ’ ;… They all get read out from php grab from db just some have links in the link attribute and some dont. How can you escape that?

you should be able to use something like this I’d think?


if(link) {
     if(link=="") {
          trace("link exists but is empty");         
     } else {
          trace("link found and link is populated");    
     }
} else {
     trace("link not found in the xml");
}