XML is automatically encoding
===

I am trying to dynamically create XML but i've run into a snag, for somereason it's automatically encoding the < and >, i need it to stop that because it's breaking my tags but i can't see anywhere in my function it's tell it to encode.


    function GenerateList($titleB, $descB, $thumbB, $dirB, $patternB){
    if (is_dir($dirB)){
    $myDirectory = opendir($dirB);
    // get each entry
    while($entryName = readdir($myDirectory)) {
    	$dirArray[] = $entryName;
    }
    
    // close directory
    closedir($myDirectory);
    
    //	count elements in array
    $indexCount	= count($dirArray);
    print ("<center><h1>'$titleB' Directory</h1>");
    $true_count = 0;
    
    // sort em
    sort($dirArray);
    $outputB = "<CATEGORY name=\"$titleB\" desc=\"$descB\" thumb=\"$thumbB\">";
    print("<TABLE border=1 cellpadding=5 cellspacing=0 class=whitelinks>");
    print("<TR><TH>Filename</TH><th>Filesize</th><TH>Filename</TH><th>Filesize</th><TH>Filename</TH><th>Filesize</th></TR>");
    print("<TR><TD colspan=2><TABLE border=0 cellpadding=0 cellspacing=0 class=whitelinks>");
    // loop through the array of files and print them all
    $one_third = round($indexCount/3);
    $two_third = $one_third+$one_third;
    for($index=0; $index < $indexCount; $index++) {
    	$ext = explode(".", $dirArray[$index]);
    	$parsed_title = preg_replace ($patternB, "", $ext[0]);
    	if ((substr("$dirArray[$index]", 0, 1) != ".")&&($ext[1] == "flv")){ // don't list hidden files
    		$true_count++;
    		print("<TR><TD><a href=\"$dirB$dirArray[$index]\">$parsed_title</a></td>");
    		print("<td>");
    		print(filesize($dirB.$dirArray[$index]));
    		print("</td>");
    		print("</TR>");
    			if ($one_third == ($index+1) || $two_third == ($index+1)){
    				print("</td></TR></table>");
    				print("</TD><TD colspan=2><TABLE border=0 cellpadding=0 cellspacing=0 class=whitelinks>");
    			}
    		$outputB .= "<ITEM>";
    		$outputB .= "<file_path>/$dirB".htmlentities($dirArray[$index])."</file_path>";
    		$outputB .= "<file_width>500</file_width>";
    		$outputB .= "<file_height>375</file_height>";
    		$outputB .= "<file_title>".$parsed_title."</file_title>";
    		$outputB .= "<file_desc>Loaded from a seperate txt file, index to match with the index of the dir file</file_desc>";
    		$outputB .= "<file_image>$thumbB</file_image>";
    		$outputB .= "<featured_image>$thumbB</featured_image>";
    		$outputB .= "<featured_or_not>true</featured_or_not>";
    		$outputB .= "</ITEM>";
    	}
    }
    print("</td></TR></table>");
    print("</TR><td colspan=6 align=right>$true_count files</td></TABLE>");
    };//if (file_exists($dirB))
    $outputB .= "</CATEGORY>";
    return $outputB;
    };//function



then i take the final output of several function calls and pass it to the xml parser

//$output = concatoniated returns of several GenerateList functions
      $dom = new DOMDocument('1.0', 'utf-8');
    
    $element = $dom->createElement('CONTENT',$output);
    
    $dom->appendChild($element);
      $xml_final = $dom->saveXML(); 
      $dom->save("playlist.xml") 

