How I can extract the XML and add an ID so that it is in a format that is pleasing to the eye. Example:
<metadata>
<data>Dato1</data>
<data2>Dato2</data2>
<data3>Dato3</data3>
<metadata>
How I can extract the XML and add an ID so that it is in a format that is pleasing to the eye. Example:
<metadata>
<data>Dato1</data>
<data2>Dato2</data2>
<data3>Dato3</data3>
<metadata>
You can use the tidy extension and send the result to the file.
<?php
$config = array(
'indent' => true,
'wrap' => 200,
'output-xml' => true,
'input-xml' => true
);
$file = "/home/xxx/Documentos/prueba.xml";
$tidy = new tidy;
$tidy->parseString(file_get_contents($file), $config, 'utf8');
$tidy->cleanRepair();
echo $tidy;
you just have to write the file the previous code only prints it.
greetings