# What's wrong in this XML command?

**URL:** <https://forum.kirupa.com/t/whats-wrong-in-this-xml-command/236843>\
**Category:** Uncategorized\
**Created:** [August 24, 2007, 3:26am UTC](https://forum.kirupa.com/t/whats-wrong-in-this-xml-command/236843 "2007-08-24T03:26:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![OMG](https://avatars.discourse-cdn.com/v4/letter/o/9dc877/32.png) [@OMG](https://forum.kirupa.com/u/OMG)\
**Post date:** [August 24, 2007, 3:26am UTC](https://forum.kirupa.com/t/whats-wrong-in-this-xml-command/236843/1 "2007-08-24T03:26:29Z")

</div>

> 

[SIZE=1][SIZE=1]hi[/SIZE]  
[SIZE=1]here’s the external XML file(simplified):[/SIZE]

```auto

[SIZE=1]<skills>[/SIZE]
[SIZE=1]<skill ID="1">......</skill>[/SIZE]
[SIZE=1]<skill ID="2">......</skill></skills>[/SIZE]

```

[SIZE=1]when I import it, everything’s fine, I put it in a variable named skills too[/SIZE]  
[SIZE=1]when I use this, I get an error:[/SIZE]  
[SIZE=1]

```auto
public function getSkillInfo():String{

```

[/SIZE]

```auto

[SIZE=1] var the_info=skills.*[0].@ID[/SIZE]
[SIZE=1]return the_info[/SIZE]
[SIZE=1]}[/SIZE]
[SIZE=1]//later: getSkillInfo()[/SIZE]

```

[SIZE=1]the error:[/SIZE]  
[SIZE=1]TypeError: Error #1009: Cannot access a property or method of a null object reference.[/SIZE]

[SIZE=1]what’s wrong?[/SIZE]  
[/SIZE]

edit:

I just found out by tracing skills that it returns null, but why?:

```auto
 
private function completeListener(e:Event) {
skills=new XML(loadFile.data)
trace(skills.toString());//everything ok
}
public function getSkillInfo(){
trace(skills);//returns null
}

```
