# \[mx04pro\] XML Connector & binding data HELP!

**URL:** https://forum.kirupa.com/t/mx04pro-xml-connector-binding-data-help/58870
**Category:** flash
**Created:** [July 26, 2004, 6:58pm UTC](https://forum.kirupa.com/t/mx04pro-xml-connector-binding-data-help/58870 "2004-07-26T18:58:13Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![kbuff](https://avatars.discourse-cdn.com/v4/letter/k/9fc29f/32.png) [@kbuff](https://forum.kirupa.com/u/kbuff)
#### Post date: [July 26, 2004, 6:58pm UTC](https://forum.kirupa.com/t/mx04pro-xml-connector-binding-data-help/58870/1 "2004-07-26T18:58:13Z")

</div>

[font=Arial]Ok, I want to create an array of objects that are assigned values based on an XML document. How would I do this with an XML structure such as:  
[/font]

```auto

<person>
  <first_name></first_name>
  <last_name></last_name>
  <id></id>
</person>
<person>
  <!-- values -->
</person>
<!-- etc... -->

```

How could I make an array, **peopleArray** , filled with the individual _person_ objects?  
This action would ideally be triggered as the frame is loaded (no user intervention required).

Thanks.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2004, 12:43am UTC](https://forum.kirupa.com/t/mx04pro-xml-connector-binding-data-help/58870/2 "2004-07-27T00:43:24Z")

</div>

That’s a tricky one. I’m not gonna write code cuz I’m lazy, but I’ll tell you the process to the best of my ability.

1)Load the Xml document. Use on onLoad function to make sure that the parsing only begins once the xml has been fully loaded. You might have to use XML.parse() function if you are not loading your XML is a standard way, i.e. from an XML file located on the server.

# 2)Write a function that loops through your xml file, checking the values of the nodes. i.e.

p=0;  
peopleArray = new Array();  
while(my\_xml.firstChild.childNodes){  
if(my\_xml.firstChild.childNodes[p] == ‘person’){  
peopleArray[p] = my\_xml.firstChild.childNodes[p].firstChild;  
}  
p++;  
}

That code I’m sure has some problems with it and there’s no way you can copy paste it into your document and have it work because I didn’t take your xml structure into account, but it’ll head you in the right direction. Sorry if this makes you more confused.

🙂

–EP

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2004, 1:12am UTC](https://forum.kirupa.com/t/mx04pro-xml-connector-binding-data-help/58870/3 "2004-07-27T01:12:14Z")

</div>

why not just use the xml? it’s really simple to do.

[this](http://studiowhiz.com/tutorials/24) should get you started.

:p:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 27, 2004, 1:29pm UTC](https://forum.kirupa.com/t/mx04pro-xml-connector-binding-data-help/58870/4 "2004-07-27T13:29:41Z")

</div>

> [@El Phantom](#):
>
> That code I’m sure has some problems with it and there’s no way you can copy paste it into your document and have it work because I didn’t take your xml structure into account, but it’ll head you in the right direction. Sorry if this makes you more confused.
> 
> 🙂
> 
> –EP

Sr. **Phantom** , thanks for the input. I don’t think I fully understood your code, but I’m studying up on XML objects and think I’ll be taking a similar approach.

I had been attempting to use an XMLConnector component which seems to be very limited to how you can manipulate the XML.

**Bodyvisual** , thanks for the link. It’s broken right now because it seems they are doing some server maintainance, but I’ll check it out later. I also found that [actionscripts.org](http://actionscripts.org) has a couple XML tutorials. So far I’m getting the impression that the XML object is MUCH more capable than XMLConnector.
