AS2 create xml in function refer from outside function

I need to create a new xml from within a function, then refer to it outside of that function.


function xmlIt(array) {
	var results_xml = new XML();
	results_xml.ignoreWhite = true;
	xmlString = toXMLString(array);

function toXMLString(toXML) {
	var xmlPush:String = new String();
	for (var n = 0; n<toXML.length; n++) {
		xmlPush += toXML[n];
	return xmlPush;

These two functions create the xml fine, but I can’t refer to that xml anywhere outside of the xmlIt() function. It comes up as undefined in the trace.

How does one go about doing this?