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

**URL:** https://forum.kirupa.com/t/name-dwg-link-if-link-is-null-dont-link/259941
**Category:** Uncategorized
**Created:** [May 10, 2008, 4:53pm UTC](https://forum.kirupa.com/t/name-dwg-link-if-link-is-null-dont-link/259941 "2008-05-10T16:53:25Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Multi\_Task](https://avatars.discourse-cdn.com/v4/letter/m/c6cbf5/32.png) [@Multi\_Task](https://forum.kirupa.com/u/Multi_Task)
#### Post date: [May 10, 2008, 4:53pm UTC](https://forum.kirupa.com/t/name-dwg-link-if-link-is-null-dont-link/259941/1 "2008-05-10T16:53:25Z")

</div>

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:

```auto

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

```

my if:

```auto

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?

---

<div class="post-metadata">

### Author: ![creatify](https://avatars.discourse-cdn.com/v4/letter/c/d07c76/32.png) [@creatify](https://forum.kirupa.com/u/creatify)
#### Post date: [May 10, 2008, 5:50pm UTC](https://forum.kirupa.com/t/name-dwg-link-if-link-is-null-dont-link/259941/2 "2008-05-10T17:50:22Z")

</div>

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

```auto

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");
}

```
