/** * Return arrays of data from an xml. * * @param SimpleXML $xml * @return array Cleaned array of arrays of data. */ protected function _getArraysFromXml($xml) { // The content cannot be get directly, because extra spaces are encoded // and end of lines are needed. So some processes are needed. $xml->registerXPathNamespace('office', 'urn:oasis:names:tc:opendocument:xmlns:office:1.0'); $xml->registerXPathNamespace('table', 'urn:oasis:names:tc:opendocument:xmlns:table:1.0'); $xml->registerXPathNamespace('text', 'urn:oasis:names:tc:opendocument:xmlns:text:1.0'); $arrays = array(); $xpath = '/office:document-content/office:body/office:spreadsheet/table:table'; $tables = $xml->xpath($xpath); foreach ($tables as $table) { $array = array(); $table->registerXPathNamespace('table', 'urn:oasis:names:tc:opendocument:xmlns:table:1.0'); $table->registerXPathNamespace('text', 'urn:oasis:names:tc:opendocument:xmlns:text:1.0'); $xpath = 'table:table-row'; $rows = $table->xpath($xpath); foreach ($rows as $row) { $currentRow = array(); $row->registerXPathNamespace('table', 'urn:oasis:names:tc:opendocument:xmlns:table:1.0'); $row->registerXPathNamespace('text', 'urn:oasis:names:tc:opendocument:xmlns:text:1.0'); $xpath = '@table:number-rows-repeated'; $repeatedRows = $row->xpath($xpath); $repeatedRows = $repeatedRows ? (int) reset($repeatedRows) : 1; $xpath = 'table:table-cell'; $cells = $row->xpath($xpath); foreach ($cells as $cell) { $text = ''; $cell->registerXPathNamespace('table', 'urn:oasis:names:tc:opendocument:xmlns:table:1.0'); $cell->registerXPathNamespace('text', 'urn:oasis:names:tc:opendocument:xmlns:text:1.0'); $xpath = '@table:number-columns-repeated'; $repeatedColumns = $cell->xpath($xpath); $repeatedColumns = $repeatedColumns ? (int) reset($repeatedColumns) : 1; // TODO Convert encoded spaces (<text:s text:c="2"/>) to true spaces. // TODO Convert styles into html (via xsl or ods 2 html). // All cells are paragraphs, even numbers. $xpath = 'text:p'; $paragraphs = $cell->xpath($xpath); foreach ($paragraphs as $paragraph) { // __toString() is not used, because there can be // sub-elements. $text .= strip_tags($paragraph->saveXML()); $text .= $this->_endOfLine; } $text = trim($text); for ($i = 1; $i <= $repeatedColumns; $i++) { $currentRow[] = $text; } } for ($i = 1; $i <= $repeatedRows; $i++) { $array[] = $currentRow; } } $arrays[] = $array; } return $arrays; }
protected function getDestinationPath($tag, $destinationBaseFolder = '') { $destinationPath = $this->destinationBasePath; $elementShortPropertyName = 'element-short'; $elementShort = $this->composer->extra->{$elementShortPropertyName}; $attributes = $this->manifest->attributes(); if (!empty($destinationBaseFolder)) { $destinationPath .= '/' . $destinationBaseFolder; } if ($destinationBaseFolder !== 'media') { // Append folders to the path according to the extension type $type = (string) $attributes['type']; switch ($type) { case 'component': $destinationPath .= "/components/com_{$elementShort}"; break; case 'plugin': $group = (string) $attributes['group']; $destinationPath .= "/plugins/{$group}/{$elementShort}"; break; case 'module': $destinationPath .= "/modules/mod_{$elementShort}"; case 'template': $destinationPath .= "/templates/{$elementShort}"; } } $subDestinationFolder = (string) $attributes['destination']; if (!empty($subDestinationFolder)) { $destinationPath .= '/' . $subDestinationFolder; } return $destinationPath; }
private function getConfiguration() { if ($this->_config == null) { $this->_config = SimpleXML::factory(BASE . "libraries/Prime/prime.xml")->get(); } return $this->_config; }
/** * update config revision information (ROOT.revision tag) * @param array|null $revision revision tag (associative array) * @param \SimpleXMLElement|null pass trough xml node */ private function updateRevision($revision, $node = null) { // input must be an array if (is_array($revision)) { if ($node == null) { if (isset($this->simplexml->revision)) { $node = $this->simplexml->revision; } else { $node = $this->simplexml->addChild("revision"); } } foreach ($revision as $revKey => $revItem) { if (isset($node->{$revKey})) { // key already in revision object $childNode = $node->{$revKey}; } else { $childNode = $node->addChild($revKey); } if (is_array($revItem)) { $this->updateRevision($revItem, $childNode); } else { $childNode[0] = $revItem; } } } }
/** * Return the raw text from an xml. * * @param SimpleXML $xml * @return string Cleaned raw text. */ protected function _getRawTextFromXml($xml) { $content = ''; // The content cannot be get directly, because extra spaces are encoded // and end of lines are needed. So some processes are needed. $xml->registerXPathNamespace('office', 'urn:oasis:names:tc:opendocument:xmlns:office:1.0'); $xml->registerXPathNamespace('text', 'urn:oasis:names:tc:opendocument:xmlns:text:1.0'); // TODO Convert encoded spaces (<text:s text:c="2"/>) to true spaces. $xpath = '/office:document-content/office:body/office:text/text:p'; $paragraphs = $xml->xpath($xpath); foreach ($paragraphs as $paragraph) { // $paragraph->__toString() is not used, because there can be // sub-elements. $content .= strip_tags($paragraph->saveXML()); $content .= $this->_endOfLine; } return $content; }
/** * Parse properties recursively * * @param \SimpleXML $xml XML object to parse * * @return array */ private function _fromXmlToArray($xml) { $result = array(); $dataNamespace = Resources::DS_XML_NAMESPACE; foreach ($xml->children($dataNamespace) as $child) { if (count($child->children($dataNamespace)) > 0) { $value = array(); foreach ($child->children($dataNamespace) as $subChild) { if ($subChild->getName() == 'element') { $value[] = $this->_fromXmlToArray($subChild); } } } else { $value = (string) $child; } $result[$child->getName()] = $value; } return $result; }
/** * Parse properties recursively * * @param \SimpleXML $xml XML object to parse * * @return array */ private static function _unserializeRecursive($xml) { $result = array(); $dataNamespace = Resources::DS_XML_NAMESPACE; foreach ($xml->children($dataNamespace) as $child) { if (count($child->children($dataNamespace)) > 0) { $value = array(); $children = $child->children($dataNamespace); $firstChild = $children[0]; if ($firstChild->getName() == 'element') { foreach ($children as $subChild) { $value[] = ContentPropertiesSerializer::_unserializeRecursive($subChild); } } else { $value = ContentPropertiesSerializer::_unserializeRecursive($child); } } else { $value = (string) $child; } $result[$child->getName()] = $value; } return $result; }
/** * update config revision information (ROOT.revision tag) * @param array|null $revision revision tag (associative array) * @param \SimpleXMLElement|null pass trough xml node */ private function updateRevision($revision, $node = null) { // if revision info is not provided, create a default. if (!is_array($revision)) { $revision = array(); // try to fetch userinfo from session if (!empty($_SESSION["Username"])) { $revision['username'] = $_SESSION["Username"]; } else { $revision['username'] = "******"; } if (!empty($_SERVER['REMOTE_ADDR'])) { $revision['username'] .= "@" . $_SERVER['REMOTE_ADDR']; } if (!empty($_SERVER['REQUEST_URI'])) { // when update revision is called from a controller, log the endpoint uri $revision['description'] = sprintf(gettext('%s made changes'), $_SERVER['REQUEST_URI']); } else { // called from a script, log script name and path $revision['description'] = sprintf(gettext('%s made changes'), $_SERVER['SCRIPT_NAME']); } } // always set timestamp $revision['time'] = microtime(true); if ($node == null) { if (isset($this->simplexml->revision)) { $node = $this->simplexml->revision; } else { $node = $this->simplexml->addChild("revision"); } } foreach ($revision as $revKey => $revItem) { if (isset($node->{$revKey})) { // key already in revision object $childNode = $node->{$revKey}; } else { $childNode = $node->addChild($revKey); } if (is_array($revItem)) { $this->updateRevision($revItem, $childNode); } else { $childNode[0] = $revItem; } } }
/** @return the string representation of this object */ public function toString() { return $this->sxe->asXML(); }
/** *18查询门店车辆列表 * @param $json_params * @return string */ public static function SearchRQ($json_params) { $request_time = time(); // 验证JSON串的正确性 if (!empty($json_params) && IconvEncode::IsJson($json_params)) { // 解析Json $request_param = json_decode($json_params, true); // 验证Json串中每一组参数的正确性 [S] if (empty($request_param['DriverAge'])) { $request_param['DriverAge'] = 26; } // 验证PickUp、DropOff、DriverAge是否存在 if (empty($request_param['PickUp']) || empty($request_param['DropOff'])) { $return_json = json_encode(array('status' => false, 'error_msg' => '0x180002_PickUp、DropOff、DriverAge不可为空')); return $return_json; } // DriverAge只能是大于0小于100的数字 if (!is_numeric($request_param['DriverAge']) || $request_param['DriverAge'] <= 18 || $request_param['DriverAge'] >= 75) { $return_json = json_encode(array('status' => false, 'error_msg' => '0x180003_DriverAge只能是大于18小于75的数字')); return $return_json; } // 声明简短变量 $PickUp_Location = empty($request_param['PickUp']['Location']) ? '' : $request_param['PickUp']['Location']; // PickUp.Location $DropOff_Location = empty($request_param['DropOff']['Location']) ? '' : $request_param['DropOff']['Location']; // DropOff.Location $PickUp_Date = empty($request_param['PickUp']['Date']) ? '' : $request_param['PickUp']['Date']; // PickUp.Date $DropOff_Date = empty($request_param['DropOff']['Date']) ? '' : $request_param['DropOff']['Date']; // DropOff.Date // 验证PickUp与DropOff下的 Location与Date是否存在 if (empty($PickUp_Location) || empty($PickUp_Date) || empty($DropOff_Location) || empty($DropOff_Date)) { $return_json = json_encode(array('status' => false, 'error_msg' => '0x180004_PickUp与DropOff下的 Location与Date是否存在')); return $return_json; } // Location下正确的参数名 $Location_Key = array('id', 'country', 'city'); // 验证PickUp.Location 中的参数名是否正确 foreach ($PickUp_Location as $key => $val) { if (!in_array($key, $Location_Key)) { $return_json = json_encode(array('status' => false, 'error_msg' => '0x180005_PickUp. Location 下的参数名错误')); return $return_json; } } // 验证DropOff.Location 中的参数名是否正确 foreach ($DropOff_Location as $key => $val) { if (!in_array($key, $Location_Key)) { $return_json = json_encode(array('status' => false, 'error_msg' => '0x180006_DropOff. Location 下的参数名错误')); return $return_json; } } // 验证PickUp.Location 中是否为填写任何条件 [id / country / city] if (count($PickUp_Location) == 0) { $return_json = json_encode(array('status' => false, 'error_msg' => '0x180007_PickUp. Location 下缺少必填参数')); return $return_json; } else { // 如按国家+城市的方式查询 if (empty($PickUp_Location['id'])) { // country与city不能单独使用 如填写了country或city的其中一个 另一个也必须填写 if (empty($PickUp_Location['country']) && !empty($PickUp_Location['city']) || !empty($PickUp_Location['country']) && empty($PickUp_Location['city'])) { $return_json = json_encode(array('status' => false, 'error_msg' => '0x180008_单独使用了PickUp.Location 下的country或city')); return $return_json; } } } // 验证DropOff.Location 中是否为填写任何条件 [id / country / city] if (count($DropOff_Location) == 0) { $return_json = json_encode(array('status' => false, 'error_msg' => '0x180009_DropOff. Location 下缺少必填参数')); return $return_json; } else { // 如按国家+城市的方式查询 if (empty($DropOff_Location['id'])) { // country与city不能单独使用 如填写了country或city的其中一个 另一个也必须填写 if (empty($DropOff_Location['country']) && !empty($DropOff_Location['city']) || !empty($DropOff_Location['country']) && empty($DropOff_Location['city'])) { $return_json = json_encode(array('status' => false, 'error_msg' => '0x180010_单独使用了DropOff.Location 下的country或city')); return $return_json; } } } // PickUp.Date 中的参数均为必填项 if (empty($PickUp_Date['year']) || empty($PickUp_Date['month']) || empty($PickUp_Date['day']) || empty($PickUp_Date['hour']) || empty($PickUp_Date['minute'])) { $return_json = json_encode(array('status' => false, 'error_msg' => '0x180011_PickUp.Date下缺少必填参数')); return $return_json; } // DropOff.Date 中的参数均为必填项 if (empty($DropOff_Date['year']) || empty($DropOff_Date['month']) || empty($DropOff_Date['day']) || empty($DropOff_Date['hour']) || empty($DropOff_Date['minute'])) { $return_json = json_encode(array('status' => false, 'error_msg' => '0x180012_DropOff.Date 下缺少必填参数')); return $return_json; } $start_time = strtotime($PickUp_Date['year'] . '-' . $PickUp_Date['month'] . '-' . $PickUp_Date['day'] . ' ' . $PickUp_Date['hour'] . ':' . $DropOff_Date['minute']); $end_time = strtotime($DropOff_Date['year'] . '-' . $DropOff_Date['month'] . '-' . $DropOff_Date['day'] . ' ' . $DropOff_Date['hour'] . ':' . $DropOff_Date['minute']); // 验证时间范围是否正确 [例:2014-13-38 错误时间strtotime会返回false] if ($start_time && $end_time) { // 结束时间不能小于开始时间 if ($end_time < $start_time) { $return_json = json_encode(array('status' => false, 'error_msg' => '0x180014_DropOff.Date 小于了PickUp.Date')); return $return_json; } } else { $return_json = json_encode(array('status' => false, 'error_msg' => '0x180013_PickUp.Date或DropOff.Date不是正确的时间')); return $return_json; } // 验证Json串中每一组参数的正确性 [E] // 判断根据ID查询还是根据国家地区查询 $PickUp_Location = empty($request_param['PickUp']['Location']['id']) ? 'country="' . $request_param['PickUp']['Location']['country'] . '" city="' . $request_param['PickUp']['Location']['city'] . '"' : 'id="' . $request_param['PickUp']['Location']['id'] . '"'; $DropOff_Location = empty($request_param['DropOff']['Location']['id']) ? 'country="' . $request_param['DropOff']['Location']['country'] . '" city="' . $request_param['DropOff']['Location']['city'] . '"' : 'id="' . $request_param['DropOff']['Location']['id'] . '"'; //remoteIp 得到客户端ip $remoteIp = !empty($request_param['remoteIp']) ? $request_param['remoteIp'] : CARRENTALAPI_REMOTEIP; if (!filter_var($remoteIp, FILTER_VALIDATE_IP)) { $return_json = json_encode(array('status' => false, 'error_msg' => '0x180015_remoteIp不是正确ip地址')); return $return_json; } // 拼接XML <SearchRQ supplierInfo="true" showReviews="true" > $request_xml = ' <SearchRQ supplierInfo="true" prefcurr="USD"> <Credentials username="******" password="******" remoteIp="' . $remoteIp . '" /> <PickUp> <Location ' . $PickUp_Location . '/> <Date year="' . $request_param['PickUp']['Date']['year'] . '" month="' . $request_param['PickUp']['Date']['month'] . '" day="' . $request_param['PickUp']['Date']['day'] . '" hour="' . $request_param['PickUp']['Date']['hour'] . '" minute="' . $request_param['PickUp']['Date']['minute'] . '"/> </PickUp> <DropOff> <Location ' . $DropOff_Location . '/> <Date year="' . $request_param['DropOff']['Date']['year'] . '" month="' . $request_param['DropOff']['Date']['month'] . '" day="' . $request_param['DropOff']['Date']['day'] . '" hour="' . $request_param['DropOff']['Date']['hour'] . '" minute="' . $request_param['DropOff']['Date']['minute'] . '"/> </DropOff> <DriverAge>' . $request_param['DriverAge'] . '</DriverAge> <Tracking adcamp="example" adplat="example"/> </SearchRQ>'; // 调用接口获取数据 $request_data = array('xml' => $request_xml); $searchRQ = GetUrlContent::fileGetContent($request_data, CARRENTALAPI_URL, 100, 'POST'); // $searchRQ='<SearchRS> <MatchList> </MatchList></SearchRS>'; // ApiLogManage::addRentalcars('SearchRQ_once',$request_xml,$searchRQ,'',$request_time,time(),1);//记录日志 $simple_xml_obj = simplexml_load_string($searchRQ); if (!$simple_xml_obj) { //判断数据是否为空 $return_json = json_encode(array('status' => false, 'error_msg' => '0x180099_返回数据为空或生成xml对象数据为false')); return $return_json; } $data_arr = SimpleXML::simplexml4array($simple_xml_obj); if (!empty($data_arr['SearchRS'][0]['MatchList']) && isset($data_arr['SearchRS'][0]['MatchList'])) { $result_arr = $data_arr['SearchRS'][0]['MatchList']; if (!is_array($result_arr[0]['Match'])) { //判断是否有车辆 $return_json = json_encode(array('status' => false, 'error_msg' => '0x180099_返回数据为空或生成xml对象数据为false')); return $return_json; } } //对数据进行处理[S] $result_arr = self::filterArray($result_arr); //过滤中间层 //下载rentalcars图片到本地 /* ini_set('display_errors', 'On');// 显示所有错误 error_reporting(E_ALL);*/ foreach ($result_arr as &$match) { if (isset($match['Match'])) { //处理车辆图片[S] $oldImageURL = $match['Match']['Vehicle']['ImageURL']['@text']; $parse_oldImageURL = parse_url($oldImageURL); $newImageFile = CARRENTAL_IMAGES_PATH . $parse_oldImageURL['path']; if (!file_exists($newImageFile)) { $match['Match']['Vehicle']['ImageURL']['@text'] = HTTP_URL . GetUrlContent::GrabImage($oldImageURL, $newImageFile); } else { $match['Match']['Vehicle']['ImageURL']['@text'] = HTTP_URL . $newImageFile; } $oldLargeImageURL = $match['Match']['Vehicle']['LargeImageURL']['@text']; $parse_oldLargeImageURL = parse_url($oldLargeImageURL); $newLargeImageFile = CARRENTAL_IMAGES_PATH . $parse_oldLargeImageURL['path']; if (!file_exists($newLargeImageFile)) { $match['Match']['Vehicle']['LargeImageURL']['@text'] = HTTP_URL . GetUrlContent::GrabImage($oldLargeImageURL, $newLargeImageFile); } else { $match['Match']['Vehicle']['LargeImageURL']['@text'] = HTTP_URL . $newLargeImageFile; } //处理车辆图片[E] //处理车辆公司logo[S] $oldSmall_logo = $match['Match']['Supplier']['@attributes']['small_logo']; $parse_oldSmall_logo = parse_url($oldSmall_logo); $newSmall_logo = CARRENTAL_IMAGES_PATH . $parse_oldSmall_logo['path']; if (!file_exists($newSmall_logo)) { $match['Match']['Supplier']['@attributes']['small_logo'] = HTTP_URL . GetUrlContent::GrabImage($oldSmall_logo, $newSmall_logo); } else { $match['Match']['Supplier']['@attributes']['small_logo'] = HTTP_URL . $newSmall_logo; } //处理车辆公司logo[E] } } //对数据进行处理[E] $result = json_encode($result_arr); if (!empty($result)) { $return_json = json_encode(array('status' => true, 'data' => $result_arr)); ApiLogManage::addRentalcars('SearchRQ', $json_params, $searchRQ, $return_json, $request_time, time(), 1); //记录日志 return $return_json; } else { $return_json = json_encode(array('status' => false, 'error_msg' => '0x180099_请求超时')); ApiLogManage::addRentalcars('SearchRQ', $json_params, $searchRQ, $return_json, $request_time, time(), 10); //记录日志 return $return_json; //请求超时 } } else { $return_json = json_encode(array('status' => false, 'error_msg' => '0x180001_JSON参数格式错误')); return $return_json; } }
/** * SimpleXML helper, append 2 objects together * @param SimpleXML $to * @param SimpleXML $from */ protected function _append(&$to, $from) { // go through each kid foreach ($from->children() as $child) { $temp = $to->addChild($child->getName(), (string) $child); foreach ($child->attributes() as $key => $value) { $temp->addAttribute($key, $value); } // perform append $this->_append($temp, $child); } }
/** * highlight text * * @param SimpleXML $xml * @return void */ public static function highlight($xml) { // FIXME: very strangely method $text = $xml->asXML(); $text = str_replace('<hlword>', '<strong>', $text); $text = str_replace('</hlword>', '</strong>', $text); $text = strip_tags($text, '<strong>'); echo $text; }
/** * Convert SimpleXML object, $sXML, into a DOM * * @param SimpleXML $sXML * * @return DOMDocument $document */ public static function importSimpleXML($sXML) { $document = new DOMDocument(); $document->loadXML($sXML->asXML()); return $document; }
/** * Parses an entity entry from given SimpleXML object. * * @param \SimpleXML $result The SimpleXML object representing the entity. * * @return \WindowsAzure\Table\Models\Entity */ private function _parseOneEntity($result) { $prefix = $this->_dataServicesMetadataPrefix; $prop = $result->content->xpath(".//{$prefix}:properties"); $prop = $prop[0]->children($this->_dataServicesNamespaceName); $entity = new Entity(); // Set ETag $etag = $result->attributes($this->_dataServicesMetadataNamespaceName); $etag = $etag[Resources::ETAG]; $entity->setETag((string) $etag); foreach ($prop as $key => $value) { $attributes = $value->attributes($this->_dataServicesMetadataNamespaceName); $type = $attributes['type']; $isnull = $attributes['null']; $value = EdmType::unserializeQueryValue((string) $type, $value); $entity->addProperty((string) $key, is_null($type) ? null : (string) $type, $isnull ? null : $value); } return $entity; }
/** * Return the XML for this chapter * * @return string */ public function getXml() { return $this->_chapter->asXml(); }
/** * 18查询租车信息 * @return String * 错误代码:[1.JSON参数格式错误 / 2.PickUp或DropOff或DriverAge 的参数名错误 / 3.DriverAge的参数错误 / 4.PickUp或DropOff下 缺少Location或Date参数 / 5.PickUp. Location 下的参数名错误 * 6.DropOff. Location 下的参数名错误 / 7.PickUp. Location 下缺少必填参数 / 8.单独使用了PickUp.Location 下的country或city / 9.DropOff. Location 下缺少必填参数 / * 10.单独使用了DropOff.Location 下的country或city / 11.PickUp.Date下缺少必填参数 / 12.DropOff.Date 下缺少必填参数 / 13.PickUp.Date或DropOff.Date不是正确的时间 / 14.DropOff.Date 小于了 PickUp.Date] */ public function actionSearchRQ() { $request_time = time(); $json_params = Yii::app()->request->getParam('json_params'); //客户端请求的json参数 // $json_params = '{"PickUp":{"Location":{"id":"1124991"},"Date":{"year":"2014","month":"12","day":"12","hour":"12","minute":"30"}},"DropOff":{"Location":{"id":"1124991"},"Date":{"year":"2014","month":"12","day":"30","hour":"12","minute":"30"}},"DriverAge":"32"}'; // 验证JSON串的正确性 if (!empty($json_params) && IconvEncode::IsJson($json_params)) { // 解析Json $request_param = json_decode($json_params, true); // 验证Json串中每一组参数的正确性 [S] // 验证PickUp、DropOff、DriverAge是否存在 if (empty($request_param['PickUp']) || empty($request_param['DropOff']) || empty($request_param['DriverAge'])) { $return_json = json_encode(array('status' => false, 'error_msg' => '2_PickUp、DropOff、DriverAge不可为空')); exit($return_json); } // DriverAge只能是大于0小于100的数字 if (!is_numeric($request_param['DriverAge']) || $request_param['DriverAge'] <= 18 || $request_param['DriverAge'] >= 75) { $return_json = json_encode(array('status' => false, 'error_msg' => '3_DriverAge只能是大于18小于75的数字')); exit($return_json); } // 声明简短变量 $PickUp_Location = empty($request_param['PickUp']['Location']) ? '' : $request_param['PickUp']['Location']; // PickUp.Location $DropOff_Location = empty($request_param['DropOff']['Location']) ? '' : $request_param['DropOff']['Location']; // DropOff.Location $PickUp_Date = empty($request_param['PickUp']['Date']) ? '' : $request_param['PickUp']['Date']; // PickUp.Date $DropOff_Date = empty($request_param['DropOff']['Date']) ? '' : $request_param['DropOff']['Date']; // DropOff.Date // 验证PickUp与DropOff下的 Location与Date是否存在 if (empty($PickUp_Location) || empty($PickUp_Date) || empty($DropOff_Location) || empty($DropOff_Date)) { $return_json = json_encode(array('status' => false, 'error_msg' => '4_PickUp与DropOff下的 Location与Date是否存在')); exit($return_json); } // Location下正确的参数名 $Location_Key = array('id', 'country', 'city'); // 验证PickUp.Location 中的参数名是否正确 foreach ($PickUp_Location as $key => $val) { if (!in_array($key, $Location_Key)) { $return_json = json_encode(array('status' => false, 'error_msg' => '5_PickUp. Location 下的参数名错误')); exit($return_json); } } // 验证DropOff.Location 中的参数名是否正确 foreach ($DropOff_Location as $key => $val) { if (!in_array($key, $Location_Key)) { $return_json = json_encode(array('status' => false, 'error_msg' => '6_DropOff. Location 下的参数名错误')); exit($return_json); } } // 验证PickUp.Location 中是否为填写任何条件 [id / country / city] if (count($PickUp_Location) == 0) { $return_json = json_encode(array('status' => false, 'error_msg' => '7_PickUp. Location 下缺少必填参数')); exit($return_json); } else { // 如按国家+城市的方式查询 if (empty($PickUp_Location['id'])) { // country与city不能单独使用 如填写了country或city的其中一个 另一个也必须填写 if (empty($PickUp_Location['country']) && !empty($PickUp_Location['city']) || !empty($PickUp_Location['country']) && empty($PickUp_Location['city'])) { $return_json = json_encode(array('status' => false, 'error_msg' => '8_单独使用了PickUp.Location 下的country或city')); exit($return_json); } } } // 验证DropOff.Location 中是否为填写任何条件 [id / country / city] if (count($DropOff_Location) == 0) { $return_json = json_encode(array('status' => false, 'error_msg' => '9_DropOff. Location 下缺少必填参数')); exit($return_json); } else { // 如按国家+城市的方式查询 if (empty($DropOff_Location['id'])) { // country与city不能单独使用 如填写了country或city的其中一个 另一个也必须填写 if (empty($DropOff_Location['country']) && !empty($DropOff_Location['city']) || !empty($DropOff_Location['country']) && empty($DropOff_Location['city'])) { $return_json = json_encode(array('status' => false, 'error_msg' => '10_单独使用了DropOff.Location 下的country或city')); exit($return_json); } } } // PickUp.Date 中的参数均为必填项 if (empty($PickUp_Date['year']) || empty($PickUp_Date['month']) || empty($PickUp_Date['day']) || empty($PickUp_Date['hour']) || empty($PickUp_Date['minute'])) { $return_json = json_encode(array('status' => false, 'error_msg' => '11_PickUp.Date下缺少必填参数')); exit($return_json); } // DropOff.Date 中的参数均为必填项 if (empty($DropOff_Date['year']) || empty($DropOff_Date['month']) || empty($DropOff_Date['day']) || empty($DropOff_Date['hour']) || empty($DropOff_Date['minute'])) { $return_json = json_encode(array('status' => false, 'error_msg' => '12_DropOff.Date 下缺少必填参数')); exit($return_json); } $start_time = strtotime($PickUp_Date['year'] . '-' . $PickUp_Date['month'] . '-' . $PickUp_Date['day'] . ' ' . $PickUp_Date['hour'] . ':' . $DropOff_Date['minute']); $end_time = strtotime($DropOff_Date['year'] . '-' . $DropOff_Date['month'] . '-' . $DropOff_Date['day'] . ' ' . $DropOff_Date['hour'] . ':' . $DropOff_Date['minute']); // 验证时间范围是否正确 [例:2014-13-38 错误时间strtotime会返回false] if ($start_time && $end_time) { // 结束时间不能小于开始时间 if ($end_time < $start_time) { $return_json = json_encode(array('status' => false, 'error_msg' => '14_DropOff.Date 小于了PickUp.Date')); exit($return_json); } } else { $return_json = json_encode(array('status' => false, 'error_msg' => '13_PickUp.Date或DropOff.Date不是正确的时间')); exit($return_json); } // 验证Json串中每一组参数的正确性 [E] // 判断根据ID查询还是根据国家地区查询 $PickUp_Location = empty($request_param['PickUp']['Location']['id']) ? 'country="' . $request_param['PickUp']['Location']['country'] . '" city="' . $request_param['PickUp']['Location']['city'] . '"' : 'id="' . $request_param['PickUp']['Location']['id'] . '"'; $DropOff_Location = empty($request_param['DropOff']['Location']['id']) ? 'country="' . $request_param['DropOff']['Location']['country'] . '" city="' . $request_param['DropOff']['Location']['city'] . '"' : 'id="' . $request_param['DropOff']['Location']['id'] . '"'; // 拼接XML $request_xml = ' <SearchRQ> <Credentials username="******" password="******" remoteIp="' . CARRENTALAPI_REMOTEIP . '" /> <PickUp> <Location ' . $PickUp_Location . '/> <Date year="' . $request_param['PickUp']['Date']['year'] . '" month="' . $request_param['PickUp']['Date']['month'] . '" day="' . $request_param['PickUp']['Date']['day'] . '" hour="' . $request_param['PickUp']['Date']['hour'] . '" minute="' . $request_param['PickUp']['Date']['minute'] . '"/> </PickUp> <DropOff> <Location ' . $DropOff_Location . '/> <Date year="' . $request_param['DropOff']['Date']['year'] . '" month="' . $request_param['DropOff']['Date']['month'] . '" day="' . $request_param['DropOff']['Date']['day'] . '" hour="' . $request_param['DropOff']['Date']['hour'] . '" minute="' . $request_param['DropOff']['Date']['minute'] . '"/> </DropOff> <DriverAge>' . $request_param['DriverAge'] . '</DriverAge> <Tracking adcamp="example" adplat="example"/> </SearchRQ>'; // 调用接口获取数据 $request_data = array('xml' => $request_xml); $searchRQ = GetUrlContent::fileGetContent($request_data, CARRENTALAPI_URL, 30, 'POST'); $simple_xml_obj = simplexml_load_string($searchRQ); $data_arr = SimpleXML::simplexml4array($simple_xml_obj); if (!empty($data_arr['SearchRS'][0]['MatchList']) && isset($data_arr['SearchRS'][0]['MatchList'])) { $result_arr = $data_arr['SearchRS'][0]['MatchList']; } $result = json_encode($result_arr); if (!empty($result)) { $return_json = json_encode(array('status' => true, 'data' => $result_arr)); ApiLogManage::addRentalcars('SearchRQ', $json_params, $searchRQ, $return_json, $request_time, time(), 1); //记录日志 echo $return_json; exit; } else { $return_json = json_encode(array('status' => false, 'error_msg' => '5_请求超时')); ApiLogManage::addRentalcars('SearchRQ', $json_params, $searchRQ, $return_json, $request_time, time(), 10); //记录日志 exit($return_json); //请求超时 } } else { $return_json = json_encode(array('status' => false, 'error_msg' => '1_JSON参数格式错误')); exit($return_json); } }
/** * Returns a constructor argument definition. * * @param SimpleXML $simpleXmlArg Argument node. * * @throws BeanFactoryException * @return BeanConstructorArgumentDefinition */ private function _loadConstructorArg($simpleXmlArg) { if (isset($simpleXmlArg->ref)) { $argType = BeanConstructorArgumentDefinition::BEAN_CONSTRUCTOR_BEAN; $argValue = (string) $simpleXmlArg->ref->attributes()->bean; } else { if (isset($simpleXmlArg->bean)) { $argType = BeanConstructorArgumentDefinition::BEAN_CONSTRUCTOR_BEAN; $name = BeanDefinition::generateName('Bean'); $argValue = $name; $simpleXmlArg->bean->addAttribute('id', $name); } else { if (isset($simpleXmlArg->null)) { $argType = BeanConstructorArgumentDefinition::BEAN_CONSTRUCTOR_VALUE; $argValue = null; } else { if (isset($simpleXmlArg->false)) { $argType = BeanConstructorArgumentDefinition::BEAN_CONSTRUCTOR_VALUE; $argValue = false; } else { if (isset($simpleXmlArg->true)) { $argType = BeanConstructorArgumentDefinition::BEAN_CONSTRUCTOR_VALUE; $argValue = true; } else { if (isset($simpleXmlArg->array)) { $argType = BeanConstructorArgumentDefinition::BEAN_CONSTRUCTOR_ARRAY; $argValue = array(); foreach ($simpleXmlArg->array->entry as $arrayEntry) { $key = (string) $arrayEntry->attributes()->key; $argValue[$key] = $this->_loadConstructorArg($arrayEntry); } } else { if (isset($simpleXmlArg->eval)) { $argType = BeanConstructorArgumentDefinition::BEAN_CONSTRUCTOR_CODE; $argValue = (string) $simpleXmlArg->eval; } else { $argType = BeanConstructorArgumentDefinition::BEAN_CONSTRUCTOR_VALUE; $argValue = (string) $simpleXmlArg->value; } } } } } } } if (isset($simpleXmlArg->attributes()->name)) { $argName = (string) $simpleXmlArg->attributes()->name; } else { $argName = false; } return new BeanConstructorArgumentDefinition($argType, $argValue, $argName); }
protected function generateRSS() { $this->generateContent(); $root = new SimpleXML('<rss />'); $root->addAttribute('version', '2.0'); $channel = $root->addChild('channel'); $channel->addChild('title', CFG_NAME_SHORT . ' - ' . $this->name); $channel->addChild('link', HOST_URL . '/?' . $this->page . ($this->category ? '=' . $this->category[0] : null)); $channel->addChild('description', CFG_NAME); $channel->addChild('language', implode('-', str_split(User::$localeString, 2))); $channel->addChild('ttl', CFG_TTL_RSS); $channel->addChild('lastBuildDate', date(DATE_RSS)); foreach ($this->feedData as $row) { $item = $channel->addChild('item'); foreach ($row as $key => list($isCData, $attrib, $text)) { if ($isCData && $text) { $child = $item->addChild($key)->addCData($text); } else { $child = $item->addChild($key, $text); } foreach ($attrib as $k => $v) { $child->addAttribute($k, $v); } } } return $root->asXML(); }
protected function generateXML($asError = false) { $root = new SimpleXML('<aowow />'); if ($asError) { $root->addChild('error', 'Item not found!'); } else { // item root $xml = $root->addChild('item'); $xml->addAttribute('id', $this->subject->id); // name $xml->addChild('name')->addCData($this->subject->getField('name', true)); // itemlevel $xml->addChild('level', $this->subject->getField('itemLevel')); // quality $xml->addChild('quality', Lang::item('quality', $this->subject->getField('quality')))->addAttribute('id', $this->subject->getField('quality')); // class $x = Lang::item('cat', $this->subject->getField('class')); $xml->addChild('class')->addCData(is_array($x) ? $x[0] : $x)->addAttribute('id', $this->subject->getField('class')); // subclass $x = $this->subject->getField('class') == 2 ? Lang::spell('weaponSubClass') : Lang::item('cat', $this->subject->getField('class'), 1); $xml->addChild('subclass')->addCData(is_array($x) ? is_array($x[$this->subject->getField('subClass')]) ? $x[$this->subject->getField('subClass')][0] : $x[$this->subject->getField('subClass')] : null)->addAttribute('id', $this->subject->getField('subClass')); // icon + displayId $xml->addChild('icon', $this->subject->getField('iconString'))->addAttribute('displayId', $this->subject->getField('displayId')); // inventorySlot $xml->addChild('inventorySlot', Lang::item('inventoryType', $this->subject->getField('slot')))->addAttribute('id', $this->subject->getField('slot')); // tooltip $xml->addChild('htmlTooltip')->addCData($this->subject->renderTooltip()); $this->subject->extendJsonStats(); // json $fields = ["classs", "displayid", "dps", "id", "level", "name", "reqlevel", "slot", "slotbak", "source", "sourcemore", "speed", "subclass"]; $json = ''; foreach ($fields as $f) { if (isset($this->subject->json[$this->subject->id][$f])) { $_ = $this->subject->json[$this->subject->id][$f]; if ($f == 'name') { $_ = 7 - $this->subject->getField('quality') . $_; } $json .= ',"' . $f . '":' . $_; } } $xml->addChild('json')->addCData(substr($json, 1)); // jsonEquip missing: avgbuyout, cooldown, source, sourcemore $json = ''; if ($_ = $this->subject->getField('sellPrice')) { // sellprice $json .= ',"sellprice":' . $_; } if ($_ = $this->subject->getField('requiredLevel')) { // reqlevel $json .= ',"reqlevel":' . $_; } if ($_ = $this->subject->getField('requiredSkill')) { // reqskill $json .= ',"reqskill":' . $_; } if ($_ = $this->subject->getField('requiredSkillRank')) { // reqskillrank $json .= ',"reqskillrank":' . $_; } foreach ($this->subject->itemMods[$this->subject->id] as $mod => $qty) { $json .= ',"' . $mod . '":' . $qty; } foreach ($_ = $this->subject->json[$this->subject->id] as $name => $qty) { if (in_array($name, Util::$itemFilter)) { $json .= ',"' . $name . '":' . $qty; } } $xml->addChild('jsonEquip')->addCData(substr($json, 1)); // jsonUse if ($onUse = $this->subject->getOnUseStats()) { $j = ''; foreach ($onUse as $idx => $qty) { $j .= ',"' . Util::$itemMods[$idx] . '":' . $qty; } $xml->addChild('jsonUse')->addCData(substr($j, 1)); } // reagents $cnd = array('OR', ['AND', ['effect1CreateItemId', $this->subject->id], ['OR', ['effect1Id', SpellList::$effects['itemCreate']], ['effect1AuraId', SpellList::$auras['itemCreate']]]], ['AND', ['effect2CreateItemId', $this->subject->id], ['OR', ['effect2Id', SpellList::$effects['itemCreate']], ['effect2AuraId', SpellList::$auras['itemCreate']]]], ['AND', ['effect3CreateItemId', $this->subject->id], ['OR', ['effect3Id', SpellList::$effects['itemCreate']], ['effect3AuraId', SpellList::$auras['itemCreate']]]]); $spellSource = new SpellList($cnd); if (!$spellSource->error) { $cbNode = $xml->addChild('createdBy'); foreach ($spellSource->iterate() as $sId => $__) { foreach ($spellSource->canCreateItem() as $idx) { if ($spellSource->getField('effect' . $idx . 'CreateItemId') != $this->subject->id) { continue; } $splNode = $cbNode->addChild('spell'); $splNode->addAttribute('id', $sId); $splNode->addAttribute('name', $spellSource->getField('name', true)); $splNode->addAttribute('icon', $this->subject->getField('iconString')); $splNode->addAttribute('minCount', $spellSource->getField('effect' . $idx . 'BasePoints') + 1); $splNode->addAttribute('maxCount', $spellSource->getField('effect' . $idx . 'BasePoints') + $spellSource->getField('effect' . $idx . 'DieSides')); foreach ($spellSource->getReagentsForCurrent() as $rId => $qty) { if ($reagent = $spellSource->relItems->getEntry($rId)) { $rgtNode = $splNode->addChild('reagent'); $rgtNode->addAttribute('id', $rId); $rgtNode->addAttribute('name', Util::localizedString($reagent, 'name')); $rgtNode->addAttribute('quality', $reagent['quality']); $rgtNode->addAttribute('icon', $reagent['iconString']); $rgtNode->addAttribute('count', $qty[1]); } } break; } } } // link $xml->addChild('link', HOST_URL . '?item=' . $this->subject->id); } return $root->asXML(); }
/** * Parses a SimpleXML object and returns an array of NCplugin objects * @access public * @param string $nodeType * @param SimpleXML $xml * @return array * @static */ public static function parse($node_type, $xml, $key = NULL) { $objects = array(); $nodes = $xml->xpath('//' . $node_type); // get related source from query if ($node_type == "sourceRelated") { $node_type = "source"; $nodes = $xml->xpath('' . $node_type); } if (empty($nodes)) { return; } foreach ($nodes as $node) { if ($node_type === 'cluster') { array_push($objects, self::_parse_cluster_node($node, $key)); } else { $method = '_parse_' . strtolower($node_type) . '_node'; array_push($objects, self::$method($node, $key)); } } return $objects; }
public function actionRen() { $a = '<SearchRS> <MatchList> <Match> <Vehicle id="274462398" propositionType="BR" automatic="Manual" aircon="Yes" airbag="false" petrol="N/A" group="ECMR" doors="2/4" seats="4" fuelPolicy="1" insurancePkg="I" freeCancellation="true" > <Name>Hyundai i20</Name> <Description>這輛兩個車門配備車載空調的經濟型轎車,是兩個人和小型家庭出遊的理想選擇。</Description> <ImageURL>http://xml.rentalcars.com:80/images/car_images/C/hyundai_i20.jpg</ImageURL> <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/C/hyundai_i20.jpg</LargeImageURL> </Vehicle> <Price currency="USD" baseCurrency="CNY" basePrice="1446.28" deposit="0.00" baseDeposit="0.0" discount="28.21" quoteAllowed="yes" >235.45</Price> <Route> <PickUp> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </PickUp> <DropOff> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </DropOff> </Route> <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier> </Match> <Match> <Vehicle id="274462388" propositionType="BR" automatic="Automatic" aircon="Yes" airbag="false" petrol="N/A" group="CDAR" doors="4" seats="5" fuelPolicy="1" insurancePkg="I" freeCancellation="true" > <Name>Hyundai Accent</Name> <Description>理想的家庭用車,四車門自動檔車身小型配备车载空调价格经济实惠。</Description> <ImageURL>http://xml.rentalcars.com:80/images/car_images/D/hyundai_accent.jpg</ImageURL> <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/D/hyundai_accent.jpg</LargeImageURL> </Vehicle> <Price currency="USD" baseCurrency="CNY" basePrice="1606.45" deposit="0.00" baseDeposit="0.0" discount="31.34" quoteAllowed="yes" >261.53</Price> <Route> <PickUp> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </PickUp> <DropOff> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </DropOff> </Route> <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier> </Match> <Match> <Vehicle id="237178731" propositionType="BR" automatic="Automatic" aircon="Yes" airbag="false" petrol="N/A" group="ECAR" doors="2/4" seats="4" fuelPolicy="1" insurancePkg="I" freeCancellation="true" > <Name>Suzuki Swift</Name> <Description>這輛兩個車門配備車載空調的經濟型轎車,是兩個人和小型家庭出遊的理想選擇。</Description> <SpecialOfferText>可免费添加一名额外驾驶人</SpecialOfferText> <ImageURL>http://xml.rentalcars.com:80/images/car_images/C/suzuki_swift.jpg</ImageURL> <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/C/suzuki_swift.jpg</LargeImageURL> </Vehicle> <Price currency="USD" baseCurrency="CNY" basePrice="1676.43" deposit="0.00" baseDeposit="0.0" discount="32.70" quoteAllowed="yes" >272.92</Price> <Route> <PickUp> <Location id="804148" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </PickUp> <DropOff> <Location id="804148" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </DropOff> </Route> <Supplier long="153.03126" lat="-27.46062" small_logo="http://xml.rentalcars.com:80/images/suppliers/thrifty_logo_lrg.gif"><![CDATA[Thrifty AW]]></Supplier> </Match> <Match> <Vehicle id="274462453" propositionType="BR" automatic="Manual" aircon="Yes" airbag="true" petrol="N/A" group="CDMR" doors="4" seats="5" fuelPolicy="1" insurancePkg="I" freeCancellation="true" > <Name>Hyundai i20</Name> <Description>理想的家庭用車,車身小巧四車門並配備車載空調,讓您的駕駛更舒適。</Description> <ImageURL>http://xml.rentalcars.com:80/images/car_images/D/hyundai_i20.jpg</ImageURL> <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/D/hyundai_i20.jpg</LargeImageURL> </Vehicle> <Price currency="USD" baseCurrency="CNY" basePrice="1734.88" deposit="0.00" baseDeposit="0.0" discount="33.84" quoteAllowed="yes" >282.44</Price> <Route> <PickUp> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </PickUp> <DropOff> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </DropOff> </Route> <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier> </Match> <Match> <Vehicle id="274462393" propositionType="BR" automatic="Automatic" aircon="Yes" airbag="false" petrol="N/A" group="EDAR" doors="4" seats="5" fuelPolicy="1" insurancePkg="I" freeCancellation="true" > <Name>Hyundai i20</Name> <Description>這輛經濟型轎車配備四個車門,車載空調和自動排擋,是兩個人和小型家庭出遊的理想之選。 </Description> <ImageURL>http://xml.rentalcars.com:80/images/car_images/D/hyundai_i20.jpg</ImageURL> <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/D/hyundai_i20.jpg</LargeImageURL> </Vehicle> <Price currency="USD" baseCurrency="CNY" basePrice="1816.29" deposit="0.00" baseDeposit="0.0" discount="35.43" quoteAllowed="yes" >295.69</Price> <Route> <PickUp> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </PickUp> <DropOff> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </DropOff> </Route> <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier> </Match> <Match> <Vehicle id="274462383" propositionType="BR" automatic="Automatic" aircon="Yes" airbag="false" petrol="N/A" group="IDAR" doors="4" seats="5" fuelPolicy="1" insurancePkg="I" freeCancellation="true" > <Name>Holden Cruze</Name> <Description>如果您和家人或者朋友們一同出遊,並想要更多的車內空間,這輛配備自動檔和車載空調的4車門汽車定能滿足您的所有要求。</Description> <ImageURL>http://xml.rentalcars.com:80/images/car_images/D/holden_cruze.jpg</ImageURL> <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/D/holden_cruze.jpg</LargeImageURL> </Vehicle> <Price currency="USD" baseCurrency="CNY" basePrice="1857.78" deposit="0.00" baseDeposit="0.0" discount="36.24" quoteAllowed="yes" >302.45</Price> <Route> <PickUp> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </PickUp> <DropOff> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </DropOff> </Route> <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier> </Match> <Match> <Vehicle id="274462433" propositionType="BR" automatic="Automatic" aircon="Yes" airbag="false" petrol="N/A" group="FCAR" doors="5" seats="5" fuelPolicy="1" insurancePkg="I" freeCancellation="true" > <Name>Volkswagen Passat</Name> <Description>這輛2/4車門配備車載空調的自動檔汽車為您提供寬敞的車內空間,讓您的旅途舒適愜意。</Description> <ImageURL>http://xml.rentalcars.com:80/images/car_images/C/vw_passat.jpg</ImageURL> <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/C/vw_passat.jpg</LargeImageURL> </Vehicle> <Price currency="USD" baseCurrency="CNY" basePrice="2133.14" deposit="0.00" baseDeposit="0.0" discount="41.61" quoteAllowed="yes" >347.28</Price> <Route> <PickUp> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </PickUp> <DropOff> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </DropOff> </Route> <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier> </Match> <Match> <Vehicle id="274462378" propositionType="BR" automatic="Automatic" aircon="Yes" airbag="false" petrol="N/A" group="SDAR" doors="4" seats="5" fuelPolicy="1" insurancePkg="I" freeCancellation="true" > <Name>Toyota Camry</Name> <Description>如果您與家人或者朋友一起出遊,那麼這輛配備自動檔和車載空調的4車門標準車型的車輛定能滿足您所有需要。</Description> <ImageURL>http://xml.rentalcars.com:80/images/car_images/D/toyota_camry.jpg</ImageURL> <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/D/toyota_camry.jpg</LargeImageURL> </Vehicle> <Price currency="USD" baseCurrency="CNY" basePrice="2148.84" deposit="0.00" baseDeposit="0.0" discount="41.92" quoteAllowed="yes" >349.83</Price> <Route> <PickUp> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </PickUp> <DropOff> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </DropOff> </Route> <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier> </Match> <Match> <Vehicle id="237178736" propositionType="BR" automatic="Automatic" aircon="Yes" airbag="false" petrol="N/A" group="PDAR" doors="5" seats="5" fuelPolicy="1" insurancePkg="I" freeCancellation="true" > <Name>Ford Falcon XR6</Name> <Description>如果您想要的更多?那麽這輛配備車載空調和自動檔的高級轎車就是為獨具慧眼的您準備的。</Description> <SpecialOfferText>可免费添加一名额外驾驶人</SpecialOfferText> <ImageURL>http://xml.rentalcars.com:80/images/car_images/D/ford_falcon_xr6.jpg</ImageURL> <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/D/ford_falcon_xr6.jpg</LargeImageURL> </Vehicle> <Price currency="USD" baseCurrency="CNY" basePrice="2378.68" deposit="0.00" baseDeposit="0.0" discount="46.40" quoteAllowed="yes" >387.25</Price> <Route> <PickUp> <Location id="804148" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </PickUp> <DropOff> <Location id="804148" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </DropOff> </Route> <Supplier long="153.03126" lat="-27.46062" small_logo="http://xml.rentalcars.com:80/images/suppliers/thrifty_logo_lrg.gif"><![CDATA[Thrifty AW]]></Supplier> </Match> <Match> <Vehicle id="237178696" propositionType="BR" automatic="Automatic" aircon="Yes" airbag="false" petrol="N/A" group="FDAR" doors="4" seats="5" fuelPolicy="1" insurancePkg="I" freeCancellation="true" > <Name>Subaru Liberty</Name> <Description>這輛4車門配備車載空調的自動檔汽車為您提供寬敞的車內空間,讓您的旅途舒適愜意。</Description> <SpecialOfferText>可免费添加一名额外驾驶人</SpecialOfferText> <ImageURL>http://xml.rentalcars.com:80/images/car_images/D/subaru_liberty.jpg</ImageURL> <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/D/subaru_liberty.jpg</LargeImageURL> </Vehicle> <Price currency="USD" baseCurrency="CNY" basePrice="2414.1" deposit="0.00" baseDeposit="0.0" discount="47.09" quoteAllowed="yes" >393.02</Price> <Route> <PickUp> <Location id="804148" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </PickUp> <DropOff> <Location id="804148" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </DropOff> </Route> <Supplier long="153.03126" lat="-27.46062" small_logo="http://xml.rentalcars.com:80/images/suppliers/thrifty_logo_lrg.gif"><![CDATA[Thrifty AW]]></Supplier> </Match> <Match> <Vehicle id="274462438" propositionType="BR" automatic="Automatic" aircon="Yes" airbag="false" petrol="N/A" group="IFAR" doors="5" seats="5" fuelPolicy="1" insurancePkg="I" freeCancellation="true" > <Name>Mitsubishi ASX</Name> <Description>如果您想享受與眾不同的駕駛感受,這輛配備自動檔的中型四輪驅動車是您理想之選。</Description> <ImageURL>http://xml.rentalcars.com:80/images/car_images/F/mitsubishi_asx.jpg</ImageURL> <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/F/mitsubishi_asx.jpg</LargeImageURL> </Vehicle> <Price currency="USD" baseCurrency="CNY" basePrice="2912.43" deposit="0.00" baseDeposit="0.0" discount="56.81" quoteAllowed="yes" >474.14</Price> <Route> <PickUp> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </PickUp> <DropOff> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </DropOff> </Route> <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier> </Match> <Match> <Vehicle id="274462458" propositionType="BR" automatic="Automatic" aircon="Yes" airbag="false" petrol="N/A" group="PCAR" doors="4" seats="5" fuelPolicy="1" insurancePkg="I" freeCancellation="true" > <Name>Mercedes A Class</Name> <Description>如果您想要的更多?那麽這輛配備車載空調和自動檔的2/4車門高級轎車就是為獨具慧眼的您準備的。</Description> <ImageURL>http://xml.rentalcars.com:80/images/car_images/C/mercedes_a_class.jpg</ImageURL> <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/C/mercedes_a_class.jpg</LargeImageURL> </Vehicle> <Price currency="USD" baseCurrency="CNY" basePrice="3284.08" deposit="0.00" baseDeposit="0.0" discount="64.06" quoteAllowed="yes" >534.65</Price> <Route> <PickUp> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </PickUp> <DropOff> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </DropOff> </Route> <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier> </Match> <Match> <Vehicle id="274462428" propositionType="BR" automatic="Automatic" aircon="Yes" airbag="false" petrol="N/A" group="ELAR" doors="3" seats="4" fuelPolicy="1" insurancePkg="I" freeCancellation="true" > <Name>Audi A1</Name> <Description></Description> <ImageURL>http://xml.rentalcars.com:80/images/car_images/L/audi_a1.jpg</ImageURL> <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/L/audi_a1.jpg</LargeImageURL> </Vehicle> <Price currency="USD" baseCurrency="CNY" basePrice="3289.7" deposit="0.00" baseDeposit="0.0" discount="64.17" quoteAllowed="yes" >535.56</Price> <Route> <PickUp> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </PickUp> <DropOff> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </DropOff> </Route> <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier> </Match> <Match> <Vehicle id="274462373" propositionType="BR" automatic="Automatic" aircon="Yes" airbag="false" petrol="N/A" group="FWAR" doors="4" seats="5" fuelPolicy="1" insurancePkg="I" freeCancellation="true" > <Name>Subaru Outback</Name> <Description>如果您想要額外的行李空間並有寬敞的家庭空間,這輛自動檔汽車是兩者的完美結合。 </Description> <ImageURL>http://xml.rentalcars.com:80/images/car_images/W/subaru_outback.jpg</ImageURL> <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/W/subaru_outback.jpg</LargeImageURL> </Vehicle> <Price currency="USD" baseCurrency="CNY" basePrice="4126.31" deposit="0.00" baseDeposit="0.0" discount="80.49" quoteAllowed="yes" >671.76</Price> <Route> <PickUp> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </PickUp> <DropOff> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </DropOff> </Route> <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier> </Match> <Match> <Vehicle id="274462418" propositionType="BR" automatic="Automatic" aircon="Yes" airbag="false" petrol="N/A" group="LDAR" doors="4" seats="5" fuelPolicy="1" insurancePkg="I" freeCancellation="true" > <Name>Audi A6</Name> <Description>這輛配備車載空調和自動排擋的豪華汽車,為您提供奢華的駕車享受,是您休閑或者公務旅行的首選。</Description> <ImageURL>http://xml.rentalcars.com:80/images/car_images/D/audi_a6.jpg</ImageURL> <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/D/audi_a6.jpg</LargeImageURL> </Vehicle> <Price currency="USD" baseCurrency="CNY" basePrice="4508.11" deposit="0.00" baseDeposit="0.0" discount="87.94" quoteAllowed="yes" >733.92</Price> <Route> <PickUp> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </PickUp> <DropOff> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </DropOff> </Route> <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier> </Match> <Match> <Vehicle id="274462403" propositionType="BR" automatic="Automatic" aircon="Yes" airbag="false" petrol="N/A" group="FFAR" doors="4" seats="5+2" fuelPolicy="1" insurancePkg="I" freeCancellation="true" > <Name>Mitsubishi Pajero</Name> <Description>如果您在尋找不同的駕駛感受,這輛配備自動檔的四輪驅動車一定能讓您的旅程充滿無限樂趣。 </Description> <ImageURL>http://xml.rentalcars.com:80/images/car_images/F/mitsubishi_pajero.jpg</ImageURL> <LargeImageURL>http://xml.rentalcars.com:80/images/car_images/newsite/F/mitsubishi_pajero.jpg</LargeImageURL> </Vehicle> <Price currency="USD" baseCurrency="CNY" basePrice="5323.21" deposit="0.00" baseDeposit="0.0" discount="103.84" quoteAllowed="yes" >866.62</Price> <Route> <PickUp> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </PickUp> <DropOff> <Location id="266159" locName="Brisbane Downtown - 布里斯班市区" onAirport="no"/> </DropOff> </Route> <Supplier long="153.031244" lat="-27.462134" small_logo="http://xml.rentalcars.com:80/images/suppliers/europcar_logo_lrg.gif"><![CDATA[Europcar]]></Supplier> </Match> </MatchList> </SearchRS> '; $simple_xml_obj = simplexml_load_string($a); $data_arr = SimpleXML::simplexml4array($simple_xml_obj); $b = 1; $a = 1; }