Skip to content

Tabs problem #12

@glka

Description

@glka

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions