Error on line 2 at column 1: Extra content at the end of the Document

Asked

Viewed 972 times

2

Hey there, guys, I’m trying to create an xml, but it returns me the error of the title, I googled and everything I saw about this was that I was missing root, however, I believe I’m using root, can help me?

$valorReal = 340.00;
$dom = new DomDocument("1.0", "ISO-8859-1");
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
$root = $dom->createElement("AUTORIZACAO");
$total = $dom->createElement("TOTAL", $valorReal);
$root->appendChild($total);
$dom->appendChild($root);

header("Content-Type: text/xml");
echo "<xmp>" . $dom->saveXML() . "</xmp>";

Edit: Other suggestions to create an xml also suits me :)

1 answer

1


Hello, the problem seems to be that root tag "xmp" that you concatenate out of XML... I also don’t understand what it means.

Testing in Firefox here, it was like this: inserir a descrição da imagem aqui

Just remove that weird tag xmp that XML is correct ;-)

  • Thanks, I’d seen it on a gringo video

Browser other questions tagged

You are not signed in. Login or sign up in order to post.