php simpleXML output generates parsing error in browser

Edo

New Member
i have created a simpleXML object in xml.php, and output it using:\[code\]header('Content-Type: text/xml');echo $XMLobject->asXML();\[/code\]but when i try to get xml.php with my browser, i get an xml parsing error. Opera says:XML parsing failed
XML parsing failed: syntax error (Line: 1, Character: 0)
Error:unexpected text (non-whitespace text outside root element)
Specification:http://www.w3.org/TR/REC-xml/
\[code\] 1: <?xml version="1.0" encoding="UTF-8"?> 2: <namevalues> 3: <teachers><teacher><id>1</id><name>??? ??? ???(?????)</name></teacher><teacher><id>2</id><name>???? ??? ?????</name></teacher></teachers><lessons><lesson><id>3</id><name>???? ????????? ? ???????</name></lesson><lesson><id>2</id><name>????? ?????? ? ??? ???</name></lesson></lessons><officialbooks><officialbook><id>1</id><name>????? 1 ? ?????????</name></officialbook></officialbooks></namevalues>\[/code\]but when i output it as text/html, and save the page as xml, then open it with my browser(tested with firefox and opera), there is no error.
the same thing happens when i try to get this page with jQuery's $.postif i get the page with post it can't be parsed but if i copy/paste the source into an array and parse that array, it works fine.is something wrong with my php code? it seems there are some illegal characters somewhere.
 
Back
Top