Fiz uma consulta do arquivo XML com php... A partir dessa consulta quero criar um arquivo xml... Eu consigo criar o arquivo xml...mais não to conseguindo colocar as variaveis no arquivo xml Código: <?php echo '-----[ Usando XMLReader ]-----<br>' , PHP_EOL; $xmll = new XMLReader(); $xmll->open( 'mes_qtd.xml' ); $manipulador_arq = fopen("fabio.xml","w+"); @fwrite($manipulador_arq,"<graph caption='Total de Quantidade' subcaption='Vendida no Mes' xAxisName='Mes' yAxisName='Quantidade' numberPrefix=''>"); while ( $xmll->read() ){ if ( ( $xmll->nodeType == XMLReader::ELEMENT ) && ( $xmll->name == 'set' ) ){ echo 'name="' , $xmll->getAttribute( 'name' ) ; echo '"', PHP_EOL; echo 'value="' , $xmll->getAttribute( 'value' ); echo '"', PHP_EOL; echo 'link="' , $xmll->getAttribute( 'link' ) ; echo '"', PHP_EOL; echo '<br>' , PHP_EOL; $xml = "<set "; //$xml .= "name= getAttribute( 'name' ) "; //$xml .= "value= getAttribute( 'value' ) "; //$xml .= "link=getAttribute( 'link' ) "; $xml .= " /> "; @fwrite($manipulador_arq,$xml); $xml = "\n \n"; } } ?> A parte que está comentada no meu código é a parte que escreve no arquivo xml mais isso não funciona... alguém sabe como posso escrever no arquivo xml as variaveis de consulta??