I have some XML response from the server, but they don't have a root element, because of that I can't parse them with the new SimpleXML, so I need to create a root element and then add all those xml to this one created root element
$res = bill_curl('GetAccounts'); //getting a list of accounts WITHOUT the <root> xml
$xml = new SimpleXMLElement("<root></root>"); // creating a root element
$xml->addChild($res); // adding to the <root> childrens
but the problem is:
1) the "<!--?xml version="1.0" encoding="UTF-8"?-->"
stays inside and the same is at the top of the document
2) got some symbols like "<", "/>" how to remove them?
Updated:
<document>
<answer>
<account>12345678</account>
<info>someinfo</info>
</answer>
<answer>
<account>23456789</account>
<info>some info</info>
</answer>
</document>
this is what i've got after string manipulation then I make:
$xml = new SimpleXMLElement($str);
and here I get an error of start and ending tags mismatching, what I am missing here?