1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
xml2array.php
См. документацию.
1<?php
2
3namespace Bitrix\Sale\TradingPlatform;
4
10{
15 public static function convert($xmlData)
16 {
17 if($xmlData == '')
18 return array();
19
20 $result = array();
21
22 if(preg_replace('/[[:^print:]]/', '', $xmlData) == "<?xml version='1.0' encoding='UTF-8'?>")
23 return array();
24
25 //$xmlData = preg_replace('/[[:^print:]]/', '', $xmlData);
26 libxml_use_internal_errors(true);
27
28 try
29 {
30 $results = new \SimpleXMLElement($xmlData, LIBXML_NOCDATA);
31 }
32 catch(\Exception $e)
33 {
34 $logger = new Logger;
35 $logger->addRecord(
37 'TRADING_PLATFORM_XML2ARRAY_ERROR',
38 'convert',
39 'Can\'t convert xmlData to SimpleXMLElement. Data: ('.$xmlData.'). Error: '.$e->getMessage()
40 );
41
42 return array();
43 }
44
45 if(!$results)
46 {
47 $logger = new Logger;
48 $logger->addRecord(
50 'TRADING_PLATFORM_XML2ARRAY_ERROR',
51 'convert',
52 'Wrong xmlData format. Data: ('.$xmlData.').'
53 );
54
55 return array();
56 }
57 elseif($jsonString = json_encode($results))
58 {
59 $result = json_decode($jsonString, TRUE);
60 }
61
62 return $result;
63 }
64
69 public static function normalize(array $branch)
70 {
71 reset($branch);
72
73 if(key($branch) !== 0)
74 $branch = array( 0 => $branch);
75
76 return $branch;
77 }
78}
const LOG_LEVEL_ERROR
Определения logger.php:15
static convert($xmlData)
Определения xml2array.php:15
static normalize(array $branch)
Определения xml2array.php:69
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393