本文整理汇总了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);
}
}
}