src/Arrays/Conversions/To/Xml.php
private function RecursXML(XMLWriter $xml, $data)
	{
		// Loop through the array
		foreach($data as $key => $value)
		{
			// Take care of any attributes
			if (!empty($key) && $key == '@attributes')
			{
				// Loop through the attributes
				foreach ($value as $attribute_name => $attribute_value)
				{
					$xml->writeAttribute($attribute_name, $attribute_value);
				}
				continue;
			}
			
			// Do we need to go further into the array
			if(is_array($value))
			{
				// Check for indexed type
				if (isset($value[0]))
				{
					foreach ($value as $value_data)
					{
						if (is_array($value_data))
						{
							$xml->startElement($key);
							$this->RecursXML($xml, $value_data);
							$xml->endElement();
						}
						else
						{
							$xml->writeElement($key, $value_data);
						}
					}
				}
				else
				{
					$xml->startElement($key);
					$this->RecursXML($xml, $value);
					$xml->endElement();
				}
				continue;
			}
			
			// We are not allowed to have a numric key
			if (is_numeric($key)) $key = 'index_'.$key;
			
			$xml->writeElement($key, $value);
		}
	}
private function RecursXML(XMLWriter $xml, $data)
	{
		// Loop through the array
		foreach($data as $key => $value)
		{
			// Take care of any attributes
			if (!empty($key) && $key == '@attributes')
			{
				// Loop through the attributes
				foreach ($value as $attribute_name => $attribute_value)
				{
					$xml->writeAttribute($attribute_name, $attribute_value);
				}
				continue;
			}
			
			// Do we need to go further into the array
			if(is_array($value))
			{
				// Check for indexed type
				if (isset($value[0]))
				{
					foreach ($value as $value_data)
					{
						if (is_array($value_data))
						{
							$xml->startElement($key);
							$this->RecursXML($xml, $value_data);
							$xml->endElement();
						}
						else
						{
							$xml->writeElement($key, $value_data);
						}
					}
				}
				else
				{
					$xml->startElement($key);
					$this->RecursXML($xml, $value);
					$xml->endElement();
				}
				continue;
			}
			
			// We are not allowed to have a numric key
			if (is_numeric($key)) $key = 'index_'.$key;
			
			$xml->writeElement($key, $value);
		}
	}
Method: RecursXML
=========================================================================
This is the resursive function that will convert the each node of the
array to xml.

Parameters:
-------------------------------------------------------------------------
$xml - The XMLWriter Instance
$data - The array to convert

Returns:
-------------------------------------------------------------------------
xml