當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PMXI_Import_Record::validateXml方法代碼示例

本文整理匯總了PHP中PMXI_Import_Record::validateXml方法的典型用法代碼示例。如果您正苦於以下問題:PHP PMXI_Import_Record::validateXml方法的具體用法?PHP PMXI_Import_Record::validateXml怎麽用?PHP PMXI_Import_Record::validateXml使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PMXI_Import_Record的用法示例。


在下文中一共展示了PMXI_Import_Record::validateXml方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: merge

 public function merge()
 {
     /* Merge nested XML/CSV files */
     if (!empty($this->nested_files)) {
         $tmp_files = array();
         foreach ($this->nested_files as $key => $nfile) {
             $nested_fileURL = array_shift(XmlImportParser::factory($this->xml, $this->xpath, $nfile, $tmp_file)->parse());
             $tmp_files[] = $tmp_file;
             if (!empty($nested_fileURL)) {
                 $errors = new WP_Error();
                 $uploader = new PMXI_Upload($nested_fileURL, $errors);
                 $upload_result = $uploader->url();
                 if ($upload_result instanceof WP_Error) {
                     $errors = $upload_result;
                 } else {
                     $source = $upload_result['source'];
                     $filePath = $upload_result['filePath'];
                     if (!empty($upload_result['root_element'])) {
                         $root_element = $upload_result['root_element'];
                     } else {
                         $root_element = '';
                     }
                     $feed_type = $upload_result['feed_type'];
                 }
                 unset($uploader);
                 $nested_xml = file_get_contents($filePath);
                 if (!empty($nested_xml)) {
                     PMXI_Import_Record::preprocessXml($nested_xml);
                     if (PMXI_Import_Record::validateXml($nested_xml) === true) {
                         $nestedDom = new DOMDocument('1.0', 'UTF-8');
                         $nestedold = libxml_use_internal_errors(true);
                         $nestedDom->loadXML($nested_xml);
                         libxml_use_internal_errors($nestedold);
                         $second = $nestedDom->documentElement;
                         if ($second->hasChildNodes()) {
                             foreach ($second->childNodes as $node) {
                                 $importNode = $this->dom->importNode($node, true);
                                 $this->dom->documentElement->appendChild($importNode);
                             }
                             $this->xml = $this->elements ? $this->dom->saveXML($this->elements->item(0)) : $this->dom->saveXML();
                         }
                         unset($nestedDom);
                     }
                 }
             }
         }
         foreach ($tmp_files as $tmp_file) {
             // remove all temporary files created
             @unlink($tmp_file);
         }
     }
 }
開發者ID:lizbur10,項目名稱:js_finalproject,代碼行數:52,代碼來源:nested.php


注:本文中的PMXI_Import_Record::validateXml方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。