[eluser]Pana_Ruplahlava[/eluser]
Hi,
i'm using this script from guide
Code:
$this->load->dbutil();
$query = $this->db->query("SELECT id_person, name, url FROM person");
$config = array (
'root' => 'root',
'element' => 'person',
'newline' => "\n",
'tab' => "\t"
);
echo $this->dbutil->xml_from_result($query, $config);
$this->output->set_content_type('text/xml');
$this->output->set_output($xml);
Its really cool, whole xml on just a bunch of lines.
BUT! I need it to use it with a version and encoding tag.
Code:
<?xml version="1.0" encoding="UTF-8"?>
I could not find, if there is any way use this helper and set xml version and encoding. When i just try to echo it, it gives me an error:
XML declaration not at beginning of document
Any ideas? I'm an xml beginner, so if there is a php function just for it, im sorry, i still could not find it
PS. That not valid document with echoed xml version looks like this.
Code:
<?xml version="1.0" encoding="UTF-8"?><root>
<person>
<id_person>1</id_person>
<name>Franta Brabec</name>
<url>http://www.flixya.com/files-photo/s/a/p/sapnwnewbie-1943053.jpg</url>
</person>
<person>
<id_person>2</id_person>
<name>Personov Druhovič</name>
<url>http://animal.discovery.com/guides/wild-birds/gallery/mallard_duck.jpg</url>
</person>
</root>
It starts with 3 blank lines with bunch of spaces(i did not put them there...)