# \[2004\] How to access specific name/value in xml-doc?

**URL:** https://forum.kirupa.com/t/2004-how-to-access-specific-name-value-in-xml-doc/220345
**Category:** flash
**Created:** [March 25, 2007, 1:10pm UTC](https://forum.kirupa.com/t/2004-how-to-access-specific-name-value-in-xml-doc/220345 "2007-03-25T13:10:02Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Danneman](https://avatars.discourse-cdn.com/v4/letter/d/b19c9b/32.png) [@Danneman](https://forum.kirupa.com/u/Danneman)
#### Post date: [March 25, 2007, 1:10pm UTC](https://forum.kirupa.com/t/2004-how-to-access-specific-name-value-in-xml-doc/220345/1 "2007-03-25T13:10:02Z")

</div>

Ive got a xml-doc (simply structured, see below for sample) that I load into my flash-app using a loop.

```php

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<datapacket>
	<row	GlobalName="gl_Project_SO_Name" GlobalValue="SpOn2"	/>
	<row	GlobalName="gl_BgColor_1"	GlobalValue="0xFFFFFF"	/>
	<row	GlobalName="gl_BgColor_2"	GlobalValue="0xF6E966"	/>	
</datapacket>

```

However, at one time in the code I want to be able to get just one of those values (gl\_Project\_SO\_Name) from the xml-file. How can this be done most easily?

The code I use to load all the variables into global variables is:

```auto

//	code: LOAD XML
var s_ProjName_Name = "";
var s_ProjName_Value = 0;

var xml_ProjName = new XML();
xml_ProjName.ignoreWhite = true;
xml_ProjName.onLoad = function(success){
	if (success){
		for (var row in this.firstChild.childNodes) {

				//	SET GLOBALS
				s_ProjName_Name = this.firstChild.childNodes[row].attributes.GlobalName;
				s_ProjName_Value = this.firstChild.childNodes[row].attributes.GlobalValue; 
				
				// set: Sätt in rätt värde i rätt global
				_global[s_ProjName_Name]	= s_ProjName_Value;
		}
	}
}
xml_ProjName.load("INIT/init.xml");

```
