public function txt2xml($txt)
{
$aNF = array();
if (is_file($txt)) {
//extrai cada linha do arquivo em um campo de matriz
$aDados = file($txt, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES | FILE_TEXT);
} elseif (is_array($txt)) {
//carrega a matriz
$aDados = $txt;
} else {
if (strlen($txt) > 0) {
//carrega a matriz com as linha do arquivo
$aDados = explode("\n", $txt);
} else {
return $aNF;
}
}
//verificar se existem mais de uma NF
$aNotas = $this->zSliceNotas($aDados);
foreach ($aNotas as $nota) {
$this->zArray2xml($nota);
//carrega os volumes, movido de yEntity
foreach ($this->linhaX26 as $vol) {
$this->zLinhaXVolEntity($vol);
}
if ($this->make->montaNFe()) {
$aNF[] = $this->make->getXML();
}
}
return $aNF;
}