コード例 #1
0
 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);
 }
コード例 #2
0
 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);
 }
コード例 #3
0
ファイル: example.php プロジェクト: annggeel/tienda
/* We can now use the rateResponse element to get access 
** to it's children.
*/
$status = $rateResp->getElement('status');
$statusMessage = $status->getElement('message');
print "<BR>Status message is " . $statusMessage->getValue() . "<BR>\n";
/* We can also access the elements by 'path' (if it is unique)
** To do so, use the getElementByPath method on an element.  The parameter
** is a path relative to this element (ie you may only access this element
** and any of it children/subchildren).
**
**
** Here we use the MiniXMLDoc object (thus the root element), so we pass
** the 'full path' as a parameter.
*/
$statusCode = $returnedXMLDoc->getElementByPath('partsRateReply/status/code');
print "<BR>Status Code is " . $statusCode->getValue() . "<BR>\n";
/* Sometimes, for instance when you have an element with 
** multiple children with the same name like partNum, it's 
** best to simply have access to all the children at once.
*/
/* First get the element */
$partList = $returnedXMLDoc->getElementByPath('partsRateReply/partList');
/* Now get the list of children */
$partListChildren = $partList->getAllChildren('part');
/* we can use the returned array to play with all the children */
for ($i = 0; $i < $partList->numChildren(); $i++) {
    print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<BR>\n";
    $name = $partListChildren[$i]->getElement('name');
    $maker = $partListChildren[$i]->getElement('maker');
    $priceAmmount = $partListChildren[$i]->getElementByPath('price/amount');
コード例 #4
0
 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;
 }
コード例 #5
0
 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);
 }
コード例 #6
0
ファイル: chewnspit.php プロジェクト: simsalabim/rasp_fu
<?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('./test.xml');
// xdebug_dump_function_profile(XDEBUG_PROFILER_FS_NC);
// xdebug_dump_function_profile();
// xdebug_dump_function_trace();
// xdebug_dump_function_trace();
print $xmlDoc->toString();
$costEl = $xmlDoc->getElementByPath('RATEQUOTE/STANDARDGROUNDTOTAL');
print "Standard: " . $costEl->getValue();
$costEl = $xmlDoc->getElementByPath('RATEQUOTE/DEFINITEDELIVERYTOTAL');
print "\nDefinite: " . $costEl->getValue();