コード例 #1
0
 function writeXMLFile($_strFileName, $_arrMenu)
 {
     $xml = new MiniXMLDoc();
     $xmlRoot =& $xml->getRoot();
     $menuBar =& $xmlRoot->createChild('menuBar');
     for ($i = 0; $i < count($_arrMenu); $i++) {
         $menu =& $menuBar->createChild('menu');
         $menuName =& $menu->createChild('name');
         $menuName->text($_arrMenu[$i]['name']);
         for ($j = 0; $j < count($_arrMenu[$i]) - 2; $j++) {
             $option =& $menu->createChild('option');
             $child =& $option->createChild('name');
             $child->text($_arrMenu[$i][$j]['name']);
             $child =& $option->createChild('type');
             $child->text('i');
             $child =& $option->createChild('link');
             $child->text($_arrMenu[$i][$j]['module_name']);
             $child =& $option->createChild('param');
             $child->text($_arrMenu[$i][$j]['param']);
         }
     }
     $this->writeFileFromString($_strFileName, $xml->toString());
 }
コード例 #2
0
    if (substr($export_data_dir, -1) != "/") {
        $export_data_dir .= "/";
    }
    $sourcefiles = array();
    $sourcefiles[] = $export_data_dir;
    // copy all necessary files:
    copy("files/adlcp_rootv1p2.xsd", $exportdir . "adlcp_rootv1p2.xsd");
    $sourcefiles[] = $exportdir . "adlcp_rootv1p2.xsd";
    copy("files/ims_xml.xsd", $exportdir . "ims_xml.xsd");
    $sourcefiles[] = $exportdir . "ims_xml.xsd";
    copy("files/imscp_rootv1p1p2.xsd", $exportdir . "imscp_rootv1p1p2.xsd");
    $sourcefiles[] = $exportdir . "imscp_rootv1p1p2.xsd";
    copy("files/imsmd_rootv1p2p1.xsd", $exportdir . "imsmd_rootv1p2p1.xsd");
    $sourcefiles[] = $exportdir . "imsmd_rootv1p2p1.xsd";
    $parsedDoc = new MiniXMLDoc();
    $xmlRoot =& $parsedDoc->getRoot();
    // Root-Element MANIFEST
    $manifest =& $xmlRoot->createChild('manifest');
    $manifest->attribute('identifier', $USER->username . 'Export');
    $manifest->attribute('version', '1.1');
    $manifest->attribute('xmlns', 'http://www.imsproject.org/xsd/imscp_rootv1p1p2');
    $manifest->attribute('xmlns:adlcp', 'http://www.adlnet.org/xsd/adlcp_rootv1p2');
    $manifest->attribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
    $manifest->attribute('xsi:schemaLocation', 'http://www.imsproject.org/xsd/imscp_rootv1p1p2 imscp_rootv1p1p2.xsd
					  http://www.imsglobal.org/xsd/imsmd_rootv1p2p1 imsmd_rootv1p2p1.xsd
					  http://www.adlnet.org/xsd/adlcp_rootv1p2 adlcp_rootv1p2.xsd');
    // Our Organizations
    $organizations =& $manifest->createChild('organizations');
    $organizations->attribute('default', 'DATA');
    // Our organization for the export structure
    $desc_organization =& $organizations->createChild('organization');
コード例 #3
0
        $folderName = $folderNameRes[1];
        //echo "<br>### doing folder : $folderName <br>";
        preg_match_all("/<Placemark>(.*)<\\/Placemark>/isU", $folder, $placemarks);
        foreach ($placemarks[1] as $placemark) {
            if (preg_match("/<name>(.*)<\\/name>.*<Point.*>.*<coordinates>(.*),(.*),(.*)<\\/coordinates>.*<\\/Point>/isU", $placemark, $info)) {
                //echo "<hr>name=".$info[1].", lat=".$info[2].", lon=".$info[3].", alt=".$info[4]."<hr>";
                $foundPoints++;
            }
        }
    }
    echo "Found {$foundPoints} points<br>";
    $foundPoints = 0;
    require_once dirname(__FILE__) . '/lib/miniXML/minixml.inc.php';
    $parsedDoc = new MiniXMLDoc();
    $parsedDoc->fromString($lines);
    $rootEl =& $parsedDoc->getRoot();
    procElement($rootEl->getElementByPath("kml"));
    //$mainFolder=$rootEl->getElementByPath("Folder");
    //$elChildren =& $mainFolder->getAllChildren();
    echo "Found {$foundPoints} points<br>";
}
function procElement(&$el, $folderName = "", $depth = 1)
{
    global $foundPoints;
    $elChildren =& $el->getAllChildren();
    //	echo "element has ".$el->numChildren()." childs, we are at depth: $depth<br>";
    for ($i = 0; $i < $el->numChildren(); $i++) {
        if ($elChildren[$i]->name() == "Placemark") {
            $pl_name = $elChildren[$i]->getElementByPath("name");
            $parent_name = $el->getElementByPath("name");
            echo "@@ " . $parent_name->getValue() . " : " . $pl_name->getValue() . "<br>";
コード例 #4
0
ファイル: genhtml.php プロジェクト: stepheneb/test-from-svn
function createHREF(&$parent, $name, $href)
{
    $ac =& $parent->createChild('a');
    $ac->attribute('href', $href);
    $afontel =& $ac->createChild('font');
    $afontel->attribute('color', '#eeeeee');
    $afontel->text($name);
    $parent->text(' ');
    return;
}
$t1NumRows = 3;
$t1NumCols = 3;
$t2NumRows = 2;
$t2NumCols = 2;
$htmlDoc = new MiniXMLDoc();
$docRoot =& $htmlDoc->getRoot();
$html =& $docRoot->createChild('html');
$head =& $html->createChild('head');
$title =& $head->createChild('title', 'MiniXML Generated HTML page');
$style =& $head->createChild('style');
$style->comment("body,td,a,p,.h{font-family:arial,sans-serif;} .q{text-decoration:none; color:#0000cc;}");
$body =& $html->createChild('body');
$body->attribute('bgcolor', '#ffffff');
$body->attribute('link', '#0000cc');
$body->attribute('vlink', '#551a8b');
$h =& $body->createChild('h3', 'This page was generated by MiniXML!');
/* Note that, when MINIXML_AUTOESCAPE_ENTITIES is set, we can stick in <> tags */
$p1 =& $body->createChild('p', "It slices, dices and never forgets the </closing tags>! heh ;) ");
$br =& $p1->createChild('br');
$p1->text("View the source of this page to take a look at ");
$href =& $p1->createChild('a');
コード例 #5
0
ファイル: example.php プロジェクト: annggeel/tienda
/* In this example, these are the part numbers we are interested in. */
$partNumbers = array('DA42', 'D99983FFF', 'ss-839uent');
/*  Create a new MiniXMLDoc object.  This document will be your 
**  interface to all the XML elements. 
*/
$xmlDoc = new MiniXMLDoc();
/* XML is created in a hierarchical manner, like a tree.  To start
** creating our request, we need this tree's root.
**
** NOTICE: 	That weirdo '=&' is not an ordinary assignment - it's PHP's
**		way of asking that $xmlRoot be a REFERENCE to the Root Element.
**		If you don't use =&, you'll be working on a copy and you'll need
**		to $xmlDoc->setRoot($xmlRoot) when you're done.
**
*/
$xmlRoot = $xmlDoc->getRoot();
/* I've imagined a fictitious structure for this request but 
** they're usually something like this... 
**
** Let's start by adding a partRateRequest element (as a 
** child of the root element) and then we'll create it's
** own children.
**
** Again, note the use of the '=&'.  The alternative is to
** use '=' and the $parent->appendChild($child) but the 
** append is easy to forget...
*/
$rateReq = $xmlRoot->createChild('partRateRequest');
/* Now we'll create a vendor and a parts list element for the
 ** request and fill those up.
 */
コード例 #6
0
ファイル: orphan.php プロジェクト: stepheneb/test-from-svn
<?php

header('Content-type: text/plain');
require_once 'minixml.inc.php';
$xmlDoc = new MiniXMLDoc();
# Fetch the ROOT element for the document
# (an instance of XML::Mini::Element)
$xmlElement =& $xmlDoc->getRoot();
# Create a sub element
$newChild =& $xmlElement->createChild('mychild');
$newChild->text('hello mommy');
# Create an orphan element
$orphan =& $xmlDoc->createElement('annie');
$orphan->attribute('hair', '#ff0000');
$orphan->text('tomorrow, tomorrow');
# Adopt the orphan
$newChild->prependChild($orphan);
$toy =& $xmlDoc->createElement('toy');
$toy->attribute('color', '#0000ff');
$toy->createChild('type', 'teddybear');
$newChild->insertChild($toy, 1);
print $xmlDoc->toString();
print "\nUhm, it's not working out - she won't stop singing... Calling removeChild()\n\n";
$newChild->removeChild($orphan);
$newChild->text('???');
print $xmlDoc->toString();
コード例 #7
0
 /**
  *
  */
 function makeXMLData()
 {
     require_once MIGUELBASE_MINIXML . '/minixml.inc.php';
     $dump_buffer = '';
     $xml = new MiniXMLDoc();
     $xmlRoot =& $xml->getRoot();
     $config =& $xmlRoot->createChild('config');
     $child =& $config->createChild('ddbbSgbd');
     $child->text(Session::getValue('host_sgbd'));
     $child =& $config->createChild('ddbbMainDb');
     $child->text(Session::getValue('ddbb_name'));
     $child =& $config->createChild('ddbbServer');
     $child->text(Session::getValue('host_name'));
     $child =& $config->createChild('ddbbUser');
     $child->text(Session::getValue('ddbb_user'));
     $child =& $config->createChild('ddbbPassword');
     $child->text(Session::getValue('ddbb_passwd'));
     $child =& $config->createChild('siteName');
     $child->text(Session::getValue('campus_name'));
     $child =& $config->createChild('Institution');
     $child->text(Session::getValue('inst_name'));
     $child =& $config->createChild('InstitutionUrl');
     $child->text(Session::getValue('inst_url'));
     $child =& $config->createChild('language');
     $child->text(Session::getValue('campus_lang'));
     $child =& $config->createChild('emailAdministrator');
     $child->text(Session::getValue('director_email'));
     $child =& $config->createChild('administratorName');
     $child->text(Session::getValue('admin_name'));
     $child =& $config->createChild('administratorSurname');
     $child->text(Session::getValue('admin_surname'));
     $child =& $config->createChild('educationManager');
     $child->text(Session::getValue('director_name'));
     $child =& $config->createChild('telephone');
     $child->text(Session::getValue('inst_phone'));
     $child =& $config->createChild('maxFilledSpaceUser');
     $child->text('100000');
     $child =& $config->createChild('maxFilledSpaceAdmin');
     $child->text('1000000');
     $child =& $config->createChild('mainInterfaceWidth');
     $child->text('100%');
     $child =& $config->createChild('miguelVersion');
     $child->text(MIGUEL_VERSION);
     $child =& $config->createChild('versionDb');
     $child->text(MIGUEL_DDBB_VERSION);
     $child =& $config->createChild('userMailCanBeEmpty');
     $child->text('true');
     $child =& $config->createChild('userPasswordCrypted');
     $child->text(Session::getValue('cript_passwd'));
     //Write data in tmp subfolder
     File::Write(CONFIG_FILE, $xml->toString());
 }