[CODE]
<?php
if ($_SERVER[‘REQUEST_METHOD’] == ‘POST’){
$objDOM = new DOMDocument();
$objDOM->loadXML($_POST[‘xml’]);
}
?>
<html>
<body>
<form action=”test.php” method=”post”>
<textarea name=”xml”>
<?php echo($_POST[‘xml’])?>
</textarea>
<input type=”submit”/>
</form>
</body>
</html>
above is my sample php page where it contains a html form with a textarea names ‘xml’. On form submit PHP is loading the string in the textarea.
adding <R r=”a”/> in textarea and submitting.
xml loads fine with PHP Version 5.3.0
but throws error with PHP Version 5.2.11
[COLOR=”Red”]PHP Warning: DOMDocument::loadXML() [domdocument.loadxml]: AttValue: ” or ‘ expected in Entity, line: 1 in *** on line 4
PHP Warning: DOMDocument::loadXML() [domdocument.loadxml]: attributes construct error in Entity, line: 1 in *** on line 4 PHP
Warning: DOMDocument::loadXML() [domdocument.loadxml]: Couldn’t find end of Start Tag R line 1 in Entity, line: 1 in *** on line 4
PHP Warning: DOMDocument::loadXML() [domdocument.loadxml]: Extra content at the end of the document in Entity, line: 1 in *** on line 4
This is a sample page.In actual scenario javascript is building an xml and posting to php.
Something to with encoding. But couldnt get it.