Hi,
I am doing a XML file with chinese and
korean characters.
It was fine when it was in English but when inserting the
chinese characters, it has errors;
Warning: SimpleXMLElement::construct()
[function.SimpleXMLElement—-construct]: Entity: line 98: parser
error : Premature end of data in tag description2 line 98 in
C:\Program Files\xampp\htdocs\plaincart\parselangxml.php on line
4
Warning: SimpleXMLElement::construct()
[function.SimpleXMLElement—-construct]: t and in the mean time,
pursuing and promoting interest of local food to even mo in
C:\Program Files\xampp\htdocs\plaincart\parselangxml.php on line
4
Fatal error: Uncaught exception ‘Exception’ with message ‘String
could not be parsed as XML’ in C:\Program
Files\xampp\htdocs\plaincart\parselangxml.php:4 Stack trace: #0
C:\Program Files\xampp\htdocs\plaincart\parselangxml.php(4):
SimpleXMLElement->__construct(‘<?xml
version=”...’
#1
C:\Program Files\xampp\htdocs\plaincart\index.php(4):
include(‘C:\Program File…’
#2 {main}
thrown in C:\Program Files\xampp\htdocs\plaincart\parselangxml.php
on line 4
I know that it has to do with the encoding but upon trying all
standards, it remains the same. Anyway, this is my parsexml
file;
<?php
$xmlFileData = file_get_contents(“lang.xml”
;
$xmlData = new SimpleXMLElement($xmlFileData);
if ($_COOKIE[‘cookieLanguage’] != ””
{
}
else {
}
$i = 0;
while($xmlData->language[$i]->type != $lang_choice) {
$i++;
} // end foreach
$lang = $xmlData->language[$i];
?>
Could anyone help me?