An error is reported when php parses XML in version 5.2. version 5.3 is normal. If (isset ($ _ POST [xmldata]) {$ string & quot; & lt; configuration & gt; & quot ;. $ _ POST [xmldata]. & quot; & lt; configuration & gt; & quot; $ doc $ xmlnewdome E php parses XML and reports an error in version 5.2. version 5.3 is normal.
If (isset ($ _ POST ['xmldata']) {
$ String =" ". $ _ POST ['xmldata']." ";
$ Doc = $ xml = new DOMDocument ();
$ Xml-> loadXML ($ string );
...
Why does the page report an error in the XML file submitted by my form?
Page prompt:
Warning: DOMDocument: loadXML () [domdocument. loadxml]: AttValue: "or 'expected in Entity, line: 2 in/usr/local/apache2/htdocs/dbmanage/xmlfile. php on line 126
Warning: DOMDocument: loadXML () [domdocument. loadxml]: attributes construct error in Entity, line: 2 in/usr/local/apache2/htdocs/dbmanage/xmlfile. php on line 126
Warning: DOMDocument: loadXML () [domdocument. loadxml]: Couldn't find end of Start Tag add line 2 in Entity, line: 2 in/usr/local/apache2/htdocs/dbmanage/xmlfile. php on line 126
Warning: DOMDocument: loadXML () [domdocument. loadxml]: AttValue: "or 'expected in Entity, line: 3 in/usr/local/apache2/htdocs/dbmanage/xmlfile. php on line 126
Warning: DOMDocument: loadXML () [domdocument. loadxml]: attributes construct error in Entity, line: 3 in/usr/local/apache2/htdocs/dbmanage/xmlfile. php on line 126
The xml format is as follows:
PHP version:
# Php-v
PHP 5.2.12 (cli) (built: Apr 25 2012 21:12:31)
------ Solution --------------------
Var_dump ($ string); // add this sentence and paste the result.
$ Xml-> loadXML ($ string );
------ Solution --------------------
Form POST? What is enctype? Or AJAX? What is Content-Type set? Look at HTTP_RAW_POST_DATA?