can't read XML via PHP

Posted by jasmine on Stack Overflow See other posts from Stack Overflow or by jasmine
Published on 2010-03-16T09:27:50Z Indexed on 2010/03/16 9:36 UTC
Read the original article Hit count: 250

Filed under:
|
|
|

I can't find the reason, only see the following error message. Input is not proper UTF-8, indicate encoding ! Bytes: 0x00 0x5D 0x5D 0x3E

the followings are my php code

$reader2 = new XMLReader();
$reader2->XML($xmlstring);
$user_data="";

while ($reader2->read()) {

    if ($reader2->name == "user_id" && $reader2->nodeType == XMLReader::ELEMENT) {
        $reader2->read();
        $user_data .=$reader2->value;
    }


}
$reader2->close();

The followings are XML data

<?xml version="1.0" encoding="UTF-8" ?>
<SOAP:Envelope xmlns:SOAP="http://www.w3.org/2003/05/soap-envelope" >
    <SOAP:Body >
<user_id>1234567890</user_id>
<greeting_name><![CDATA[ABCDEF ..yl/?]]></greeting_name>
</SOAP:Body>
</SOAP:Envelope>

I try a lot of ways,but still can't find the solution. the greeting tag value may be chinese or English words.

© Stack Overflow or respective owner

Related posts about php

Related posts about Xml