Warning: DOMDocument::createElement() [domdocument.createelement]: unterminated entity reference valgmae" in Z:\home\localhost\www\indexD.php on line 76 День добрый. Не могу понять на что он ругается. В фал пишет верно, но почему ругается? Может кто сталкивался уже. Причем это на 640 итерации, я даже файл достал , проверил , там все ок. Строчка на которую ругается: PHP: $name1 = $xml->createElement("name" ,$row['pol_name']); $recipient->appendChild($name1); Переменная $row['pol_name'] = "mpm agd" s.a. На 640 итерации. В чем тут проблема? Спасибо.
Нету. PHP: $xml = new DOMDocument("1.0", "UTF-8"); $xml->FormatOutput = true; $string_value = $xml->saveXML(); //root while ($row = mysql_fetch_assoc($res)){ //first block $issuanse = $xml->createElement("issuanse"); $issuanse->setAttribute("xmlns","http://www.w3schools.com"); $issuanse->setAttribute("sender",$row['sender']); $xml->appendChild($issuanse); $general = $xml->createElement("general"); $issuanse->appendChild($general); $number = $xml->createElement("number" , $row['number']); $general->appendChild($number); $dateIssuance = $xml->createElement("dateIssuance" , $row['d_issuance']); $general->appendChild($dateIssuance); $dateTransaction = $xml->createElement("dateTransaction" , $row['d_transact']); $general->appendChild($dateTransaction); $documentType = $xml->createElement("documentType" , $row['doc_type']); $general->appendChild($documentType); //next block $provider = $xml->createElement("provider"); $issuanse->appendChild($provider); $providerStatus = $xml->createElement("providerStatus" , $row['post_stat']); $provider->appendChild($providerStatus); $dependentPerson = $xml->createElement("dependentPerson" , $row['post_dep_p']); $provider->appendChild($dependentPerson); $residentsOfOffshore = $xml->createElement("residentsOfOffshore" , $row['post_resid']); $provider->appendChild($residentsOfOffshore); $specialDealGoods = $xml->createElement("specialDealGoods" , $row['post_spec']); $provider->appendChild($specialDealGoods); $bigCompany = $xml->createElement("bigCompany" , $row['post_big_c']); $provider->appendChild($bigCompany); $countryCode = $xml->createElement("countryCode" , $row['post_str']); $provider->appendChild($countryCode); $unp = $xml->createElement("unp" , $row['post_unp']); $provider->appendChild($unp); $name = $xml->createElement("name" , $row['post_name']); $provider->appendChild($name); $address = $xml->createElement("address" , $row['post_adr']); $provider->appendChild($address); //next block $recipient = $xml->createElement("recipient"); $issuanse->appendChild($recipient); $recipientStatus = $xml->createElement("recipientStatus" , $row['pol_stat']); $recipient->appendChild($recipientStatus); $dependentPerson = $xml->createElement("dependentPerson" , $row['pol_dep_p']); $recipient->appendChild($dependentPerson); $residentsOfOffshore = $xml->createElement("residentsOfOffshore" , $row['pol_resid']); $recipient->appendChild($residentsOfOffshore); $specialDealGoods = $xml->createElement("specialDealGoods" , $row['pol_spec']); $recipient->appendChild($specialDealGoods); $bigCompany = $xml->createElement("bigCompany" , $row['pol_big_c']); $recipient->appendChild($bigCompany); $countryCode = $xml->createElement("countryCode" , $row['pol_str']); $recipient->appendChild($countryCode); $unp = $xml->createElement("unp" , $row['pol_unp']); $recipient->appendChild($unp); $name1 = $xml->createElement("name" ,$row['pol_name']); $recipient->appendChild($name1); $address = $xml->createElement("address" , $row['pol_adr']); $recipient->appendChild($address); $xml->save('file2/'.$row['number'].'.xml'); $xml = new DOMDocument("1.0", "UTF-8"); } кратко. Все дело в том что все предыдущие файлы пишет нормально, потом ошибка, потом еще 200 чтук пишет нормально и на 201 опять эта ошибка. Но структура файла не меняется. Если я отключу вывод ошибок будет все работать как я и хотел и все запишется. но хотелось бы разобраться в чем тут соль.
У тебя там случайно не Denwer с php 5.2/5.3? Попробуй код запустить на чём-то свежем. Например open-server.ru там 5.6 и 7 есть.
Я разобрался откуда ошибка. Дело в том что именно в XML не выводит знак '&'. Может знает кто как из БД его достать?