#37010 [Opn->Fbk]: error while loading a string into dom object

From: Date: Fri, 07 Apr 2006 17:04:45 +0000
Subject: #37010 [Opn->Fbk]: error while loading a string into dom object
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-95440@lists.php.net to get a copy of this message
ID: 37010 Updated by: tony2001@php.net Reported By: hari_sayiri at rediffmail dot com -Status: Open +Status: Feedback Bug Type: DOM XML related Operating System: windows 200 PHP Version: 5.1.2 New Comment: >$xml = $_POST['config']; Could you please provide _complete_ script, that doesn't use any external data etc. ? Thanks. Previous Comments: ------------------------------------------------------------------------ [2006-04-07 16:55:33] hari_sayiri at rediffmail dot com <?php $objDOM = new DOMDocument(); $xml = $_POST['config']; $objDOM->loadXML($string); $map = $objDOM->getElementsByTagName("map")->item(0); $mapsize = $map->getAttribute('size'); echo $mapsize; ?> ------------------------------------------------------------------------ [2006-04-07 16:36:11] tony2001@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try to avoid embedding huge scripts into the report. Cannot reproduce. ------------------------------------------------------------------------ [2006-04-07 16:30:45] hari_sayiri at rediffmail dot com Description: ------------ I am posting a string from a vb.net pogram to a php program, the string is basically xml tags, i am able to get the string in php, but when u try to load the string using loadxml function i get the warning message Warning: DOMDocument::loadXML() [function.loadXML]: Start tag expected, '<' not found in Entity and so i am unable to retrieve the tag attributes and values. Reproduce code: --------------- $objDOM->loadXML($string); where $string is <?xml version='1.0' encoding='UTF-8'?><map><mapsize size='2500 2500'/> </map> Expected result: ---------------- i should get the attribute value into a variable by using dom functions $map = $objDOM->getElementsByTagName("map")->item(0); $mapsize = $map->getAttribute('size'); Actual result: -------------- getting the above warning message and Fatal error: Call to a member function getAttribute() on a non-object ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37010&edit=1

« previous php.bugs (#95440) next »