本文整理汇总了PHP中XMLParser::findElementWithContent方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLParser::findElementWithContent方法的具体用法?PHP XMLParser::findElementWithContent怎么用?PHP XMLParser::findElementWithContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLParser
的用法示例。
在下文中一共展示了XMLParser::findElementWithContent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: connectDAL
/**
* Establishes a connection to the DAL module with the given ID.
*
* @param string $moduleID
* The ID of a module that is specified in the following description e.g.
* "ReadCSV"
*
* @param string $moduleDesc
* Description of the DAL modules as XML structure as returned by
* getDALModules().
*
* @return string
* An XML structure with the value <true> if the connection was
* successfully established, <false> and an error message otherwise.
* Example:
* <?xml version="1.0"?>
* <ReturnValue xmlns="http://www.ontoprise.de/smwplus#">
* <value>true</value>
* <message>Successfully connected to module "ReadCSV".</message>
* </ReturnValue >
*
*/
public function connectDAL($moduleID, &$moduleDesc)
{
global $smwgDIIP;
require_once $smwgDIIP . '/specials/TermImport/SMW_XMLParser.php';
$retVal = 'true';
$parser = new XMLParser($moduleDesc);
$result = $parser->parse();
if ($result !== TRUE) {
$msg = $result;
$retVal = 'false';
} else {
$moduleSpec = $parser->findElementWithContent('ID', $moduleID);
if ($moduleSpec) {
$className = $moduleSpec['CLASS']['value'];
$file = $moduleSpec['FILE']['value'];
$inc = TERM_IMPORT_PATH . $file . '.php';
if (include_once $inc) {
$this->connectedDAL = new $className();
$msg = wfMsg('smw_ti_succ_connected', $moduleID);
} else {
$msg = wfMsg('smw_ti_class_not_found', $className);
}
} else {
$msg = wfMsg('smw_ti_no_tl_module_spec', $moduleID);
$retVal = 'false';
}
}
return '<?xml version="1.0"?>' . "\n" . '<ReturnValue xmlns="http://www.ontoprise.de/smwplus#">' . "\n" . '<value>' . $retVal . '</value>' . "\n" . '<message>' . $msg . '</message>' . "\n" . '</ReturnValue >' . "\n";
}