Soapbox / laravel-formatter

A Formatter Class for Laravel 4 based on FuelPHP's Formatter Class
249 stars 95 forks source link

adding <XML> tag at top of array to XML conversion #30

Open adevapp opened 9 years ago

adevapp commented 9 years ago

When converting an array to XML, the package seems to add an extra XML tag.

    $this->Report = array(
        "Service" => array(
            "ID" => $serviceID,

Is coming out with an XML open and close tag around the array.

How can I convert without this being added?

johnvic commented 8 years ago

+1

yasinkocak commented 8 years ago

+1

ghost commented 8 years ago

+1

megadola commented 8 years ago

+1

YelzhasSagidulla commented 7 years ago

I found solution:

        $formatter = Formatter::make($response, Formatter::ARR);

        $res = $formatter->toXml();

        $res = str_replace('<xml>', '', $res);
        $res = str_replace('</xml>', '', $res);

Now $res contains response without xml tags