simplexml - "String could not be parsed as XML" php error -


i keep getting error when try create new instance of simplexmlelement.

i checked xml syntax manually , online tools, , copy/pasted example xml file php.net, i’m still getting error.

my code:

include 'example.php'; $namevalues= new simplexmlelement($xmlstr); 

the example.php:

<?php $xmlstr = <<<xml <?xml version='1.0' standalone='yes'?> <movies> <movie> <title>php: behind parser</title> <characters> <character> <name>ms. coder</name> <actor>onlivia actora</actor> </character> <character> <name>mr. coder</name> <actor>el act&#211;r</actor> </character> </characters> <plot> so, language. it's like, programming language. or scripting language? revealed in thrilling horror spoof of documentary. </plot> <great-lines> <line>php solves web problems</line> </great-lines> <rating type="thumbs">7</rating> <rating type="stars">5</rating> </movie> </movies> xml; ?> 

the error:

fatal error: uncaught exception 'exception' message 'string not parsed xml' in c:\abyssroot\htdocs\forum\sources\showhomework.php on line 266

i replicated message making sure example.php cannot found. think problem too.

check example.php in directory includes served or else, put in same directory.

if indeed case, need turn error reporting levels, saw notice , 2 warnings prior exception - these spell out causing problem, , save lot of time, effort , hair.

setting error reporting


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

c++ - Accessing inactive union member and undefined behavior? -

php - Get uncommon values from two or more arrays -