An error is reported when php parses XML in version 5.2. generally, version 5.3

Source: Internet
Author: User
Tags form post
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;/co php: an error is reported when parsing XML 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?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.