“String could not be parsed as XML” php error

jesse9910

New Member
i keep getting this error when i try to create a new instance of SimpleXMLElement.i checked my xml syntax manually and with online tools, and even copy/pasted the example XML file from php.net, but i'm still getting the error.
my code:
\[code\]265: include 'example.php';266: $namevalues= new SimpleXMLElement($xmlstr);\[/code\]
the example.php:
\[code\]<?php$xmlstr = <<<XML<?xml version='1.0' standalone='yes'?><movies> <movie> <title>PHP: Behind the Parser</title> <characters> <character> <name>Ms. Coder</name> <actor>Onlivia Actora</actor> </character> <character> <name>Mr. Coder</name> <actor>El ActÓr</actor> </character> </characters> <plot> So, this language. It's like, a programming language. Or is it a scripting language? All is revealed in this thrilling horror spoof of a documentary. </plot> <great-lines> <line>PHP solves all my web problems</line> </great-lines> <rating type="thumbs">7</rating> <rating type="stars">5</rating> </movie></movies>XML;?>\[/code\]the error:\[quote\] Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in C:\AbyssRoot\htdocs\Forum\Sources\showhomework.php on line 266\[/quote\]
 
Back
Top