function setCollectionServer() { global $collexis_def, $lang; if ($_SESSION['collectionServer'] != '') { $this->collectionServer = $_SESSION['collectionServer']; } else { $configXML = new MiniXMLDoc(); $configXML->fromFile($collexis_def["DOCUMENT_ROOT"] . 'xml/' . $lang . '/config.xml'); $configRoot = $configXML->toArray(); foreach ($configRoot['config']['collection-list']['collection'] as $collection) { $name = $collection['name']; $server = $collection['server']; $this->collectionServer[$name] = $server; } $_SESSION["collectionServer"] = $this->collectionServer; } return; }
function _processXMLInitData($str_fileName) { //Include XMLMini require_once MIGUELBASE_MINIXML . '/minixml.inc.php'; //Abrimos el fichero $xml_obj = new MiniXMLDoc(); //Procesamos el contenido $xml_obj->fromFile($str_fileName); //Cargamos la variable $xml_root =& $xml_obj->getElementByPath('menuBar'); $num_elem = $xml_root->numChildren(); $root_elements =& $xml_root->getAllChildren(); for ($i = 0; $i < $num_elem; $i++) { if ($root_elements[$i]->name() == 'menu') { //Datos del menu $menu =& $root_elements[$i]; $num_menus = $menu->numChildren(); $menu_items =& $menu->getAllChildren(); for ($j = 0; $j < $num_menus; $j++) { switch ($menu_items[$j]->name()) { case 'name': $menuName = $menu_items[$j]->getValue(); $this->menus[$i]['name'] = $menuName; case 'option': //Datos del menu $option =& $menu_items[$j]; $num_options = $option->numChildren(); $option_items =& $option->getAllChildren(); for ($k = 0; $k < $num_options; $k++) { $strOptionName = $option_items[$k]->name(); $strOptionValue = $option_items[$k]->getValue(); $this->menus[$i][$j][$strOptionName] = $strOptionValue; } break; } } } } //Debug::oneVar($this->menus, __FILE__, __LINE__); //Cerramos el xml unset($xml_obj); }
<?php /* This little test demonstrates the use of fromFile() ** mainly so you can play with the MINIXML_USEFROMFILECACHING ** option. For the moment, file caching is hardly usefull ** but this may change if we implement an XSLT interface. */ header('Content-type: text/plain'); require_once 'minixml.inc.php'; $xmlDoc = new MiniXMLDoc(); $xmlDoc->fromFile('./test.xml'); print $xmlDoc->toString();
function _processXMLInitData($str_fileName) { //Include XMLMini require_once MIGUELBASE_MINIXML . '/minixml.inc.php'; //Abrimos el fichero $xml_obj = new MiniXMLDoc(); //Procesamos el contenido $xml_obj->fromFile($str_fileName); //Cargamos la variable $xml_root =& $xml_obj->getElementByPath('config'); $xml_elements =& $xml_root->getAllChildren(); for ($i = 0; $i < $xml_root->numChildren(); $i++) { $_SESSION["CONTEXT"]["MIGUEL_" . strtoupper($xml_elements[$i]->name())] = $xml_elements[$i]->getValue(); } //Cerramos el fichero unset($xml_obj); }
<?php /** ensure this file is being included by a parent file */ defined('_JEXEC') or die('Restricted access'); require "minixml/minixml.inc.php"; print "<pre>\n"; $xd = new MiniXMLDoc(); $xd->fromFile("canPos_return.xml"); print "\nStatusCode = " . fetchValue($xd, 'eparcel/ratesAndServicesResponse/statusCode'); print "\ncomment = " . fetchValue($xd, 'eparcel/ratesAndServicesResponse/comment'); print "\nstatusMessage = " . fetchValue($xd, 'eparcel/ratesAndServicesResponse/statusMessage'); print "\n\n"; $shipping_fields = array("name", "rate", "shippingDate", "deliveryDate", "deliveryDayOfWeek", "nextDayAM", "packingID"); var_dump(fetchArray($xd, 'eparcel/ratesAndServicesResponse', 'product', $shipping_fields)); print "\n</pre>"; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - function fetchArray(&$xmldoc, $path, $tag, $fields) { $response = $xmldoc->getElementByPath($path); $children = $response->getAllChildren(); $count = 0; $array = array(); for ($i = 0; $i < $response->numChildren(); $i++) { if ($tag == $children[$i]->name()) { foreach ($fields as $field) { $name = $children[$i]->getElement($field); $array[$count][$field] = $name->getValue(); } $count++; } }
function isPackageFile($p_file) { global $zoom; $xmlDoc = new MiniXMLDoc(); $xmlDoc->fromFile($p_file); $iszoomupdate =& $xmlDoc->getElementByPath('zoomupdate'); if ($iszoomupdate) { // Set the type $this->installType($iszoomupdate->attribute("type")); $this->installFilename($p_file); return $xmlDoc; } return null; }
$messageArray["pt"]["invalid"] = "Usuário e/ou senha inválidos. Por favor verifique."; $messageArray["pt"]["back"] = "voltar"; $messageArray["es"]["invalid"] = "Usuario y/o contraseña inválidos. Por favor verifique."; $messageArray["es"]["back"] = "volver"; $messageArray["en"]["invalid"] = "Invalid user or password. Please verify."; $messageArray["en"]["back"] = "back"; $message = $messageArray[$lang]; if (isset($_POST["auth_submit"])) { include "auth_config.php"; $filename = $database_name; if (!file_exists($filename)) { echo "Invalid user file. Please check DATABASE_PATH in \"bvs-site-config.php\" file."; } else { $logged_in = 0; $xmlDoc = new MiniXMLDoc(); $xmlDoc->fromFile($filename); $usersXml = $xmlDoc->toArray(); foreach ($usersXml['users']['user'] as $user) { if (isset($user['_attributes'])) { $username = $user['_attributes']['name']; $password = $user['_attributes']['password']; $level = $user['_attributes']['type']; } else { $username = $user['name']; $password = $user['password']; $level = $user['type']; } if ($_POST["auth_usr"] == trim($username) && md5($_POST["auth_pwd"]) == trim($password)) { $logged_in = 1; break; }
<?php /* This little test demonstrates the use of fromFile() ** mainly so you can play with the MINIXML_USEFROMFILECACHING ** option. For the moment, file caching is hardly usefull ** but this may change if we implement an XSLT interface. */ // xdebug_start_profiling(); header('Content-type: text/plain'); require_once 'minixml.inc.php'; $xmlDoc = new MiniXMLDoc(); $xmlDoc->fromFile('./newsmltest.xml'); // xdebug_dump_function_profile(XDEBUG_PROFILER_FS_NC); // xdebug_dump_function_profile(); // xdebug_dump_function_trace(); // xdebug_dump_function_trace(); print $xmlDoc->toString();
<?php /* This little test demonstrates the use of the new parser and ** toArray() method */ header('Content-type: text/plain'); require_once 'minixml.inc.php'; $xmlDoc = new MiniXMLDoc(); $xmlDoc->fromFile('./rsstest.xml'); print_r($xmlDoc->toArray());
function demo() { print "<pre>\n"; $xd = new MiniXMLDoc(); $xd->fromFile("canPos_return.xml"); print "\nStatusCode = " . fetchValue($xd, 'eparcel/ratesAndServicesResponse/statusCode'); print "\ncomment = " . fetchValue($xd, 'eparcel/ratesAndServicesResponse/comment'); print "\nstatusMessage = " . fetchValue($xd, 'eparcel/ratesAndServicesResponse/statusMessage'); print "\n\n"; $shipping_fields = array("name", "rate", "shippingDate", "deliveryDate", "deliveryDayOfWeek", "nextDayAM", "packingID"); var_dump(fetchArray($xd, 'eparcel/ratesAndServicesResponse', 'product', $shipping_fields)); print "\n</pre>"; }
function _processXMLInitData($str_fileName) { //Include XMLMini require_once MIGUELBASE_MINIXML . '/minixml.inc.php'; //Abrimos el fichero $xml_obj = new MiniXMLDoc(); //Procesamos el contenido $xml_obj->fromFile($str_fileName); //Cargamos la variable $xml_root =& $xml_obj->getElementByPath('registry'); $num_elem = $xml_root->numChildren(); $root_elements =& $xml_root->getAllChildren(); for ($i = 0; $i < $num_elem; $i++) { //Datos del modulo $data =& $root_elements[$i]->getElementByPath('data'); $module =& $data->getElementByPath('name'); $data_elements =& $data->getAllChildren(); for ($j = 0; $j < $data->numChildren(); $j++) { $this->modules[$module->getValue()][$data_elements[$j]->name()] = $data_elements[$j]->getValue(); } //Datos de los servicios $services =& $root_elements[$i]->getElementByPath('services'); $services_elements =& $services->getAllChildren(); for ($j = 0; $j < $services->numChildren(); $j++) { $service_element =& $services_elements[$j]->getAllChildren(); $service_name =& $services_elements[$j]->getElementByPath('name'); for ($k = 0; $k < $services_elements[$j]->numChildren(); $k++) { $this->services[$service_name->getValue()][$service_element[$k]->name()] = $service_element[$k]->getValue(); } $this->services[$service_name->getValue()]['module'] = $module->getValue(); } //Datos de los interfaces $functions =& $root_elements[$i]->getElementByPath('functions'); $functions_elements =& $functions->getAllChildren(); for ($j = 0; $j < $functions->numChildren(); $j++) { $function_element =& $functions_elements[$j]->getAllChildren(); $method =& $functions_elements[$j]->getElementByPath('method'); $inter_name = $module->getValue() . '::' . $method->getValue(); for ($k = 0; $k < $functions_elements[$j]->numChildren(); $k++) { $this->interfaces[$inter_name][$function_element[$k]->name()] = $function_element[$k]->getValue(); } $this->interfaces[$inter_name]['module'] = $module->getValue(); } } //Cerramos el xml unset($xml_obj); }