array2xml
array2xml copied to clipboard
Tabs problem
Hello, i have a problem with tabs inside nodes. If node has attributes but has not any content it create empty tabs inside node, so xml is not valid. The solution for me is to comment 336 and 375 lines ("$this->writer->text(str_repeat($this->newTab, $tabs_count));" ). Can u comment this lines or make another solution?
Unvalid php code:
$xmlArray = new Array2XML();
$xmlArray->setEmptyElementSyntax(Array2xml::EMPTY_SELF_CLOSING);
$xmlArray->setRootName("Файл");
$xmlArray->setEncoding("WINDOWS-1251");
$xmlArray->setVersion("1.0");
$document = array();
$document["а"]["a1"] = array();
$document["а"]["a1"]["@attributes"] = array("aaa"=>"aaa");
$xmlString = $xmlArray->convert($document);
header('Content-type: application/xml');
echo $xmlString;
There is a second problem for me. If node has attributes it is not auto self closed. Can u fix it too?