当前位置: 首页>>代码示例>>PHP>>正文


PHP domDocument::load方法代码示例

本文整理汇总了PHP中domDocument::load方法的典型用法代码示例。如果您正苦于以下问题:PHP domDocument::load方法的具体用法?PHP domDocument::load怎么用?PHP domDocument::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在domDocument的用法示例。


在下文中一共展示了domDocument::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkLogin

		public function checkLogin(){
			$document = new domDocument();
			$document->load("users/users.xml");
			$xpath = new domXpath($document);
			$nodelist = $xpath->query("/*/user[string(login) = '$this->login']");
			return ($nodelist->length == 0)?false:true; 
		}
开发者ID:echmaster,项目名称:data,代码行数:7,代码来源:User.php

示例2: viewInfo

function viewInfo($node)
{
    if ($_POST["model1"] == "telefon") {
        $nameEl = "телефона";
    }
    if ($_POST["model2"] == "noutbuk") {
        $nameEl = "ноутбука";
    }
    if ($_POST["model3"] == "printer") {
        $nameEl = "принтера";
    }
    echo "<tr>\n\t\t<td><b>Марка " . $nameEl . "</b>\n\t\t</td><td><b>Год выпуска</b>\n\t</td></tr>";
    $document = new domDocument("1.0", "utf-8");
    $document->load("test3.xml");
    $nodelist = $document->getElementsByTagName("model");
    $model = $nodelist->item($i);
    for ($i = 0; $i < $nodelist->length; $i++) {
        $model = $nodelist->item($i);
        if ($model->parentNode->nodeName == $node || $model->parentNode->nodeName == "asort:" . $node) {
            $name = $model->childNodes->item(0);
            $year = $model->childNodes->item(1);
            echo "<tr>\n\t\t\t\t<td>" . $name->nodeValue . "</td>\n\t\t\t\t<td align='center'>" . $year->nodeValue . "</td>\n\t\t\t</tr>";
        }
    }
}
开发者ID:echmaster,项目名称:data,代码行数:25,代码来源:dz.php

示例3: __construct

 /**
  * Brief Description.
  * Complete Description.
  *
  * @param $file' (tipo) desc
  *
  * @returns (tipo) desc
  *
  */
 public function __construct($file = '', $options = 0)
 {
     $this->tree = null;
     $this->stack = array();
     // this keeps track of what tag level you're at
     $doc = new domDocument();
     $doc->preserveWhiteSpace = false;
     $doc->load($file, $options);
     $root = $doc->documentElement;
     $this->parse($doc);
 }
开发者ID:joshuacoddingyou,项目名称:php,代码行数:20,代码来源:mxmltree.php

示例4: execute

 public function execute($request)
 {
     $this->form = new sfForm();
     $this->timer = new QubitTimer();
     $this->terms = array();
     $this->termsPerPage = intval(sfConfig::get('app_hits_per_page'));
     $this->taxonomy = null;
     $this->parent = QubitTerm::getById(QubitTerm::ROOT_ID);
     if (isset($this->getRoute()->resource)) {
         $resource = $this->getRoute()->resource;
         if ('QubitTaxonomy' == $resource->className) {
             $this->taxonomy = QubitTaxonomy::getById($resource->id);
         } else {
             $this->parent = QubitTerm::getById($resource->id);
             $this->taxonomy = $this->parent->taxonomy;
         }
     }
     if (!isset($this->taxonomy)) {
         $this->forward404();
     }
     // Check user authorization
     if (!QubitAcl::check($this->parent, 'create')) {
         QubitAcl::forwardUnauthorized();
     }
     $this->form->setWidget('file', new sfWidgetFormInputFile());
     $this->form->setValidator('file', new sfValidatorFile());
     if ($request->isMethod('post')) {
         $this->form->bind($request->getPostParameters(), $request->getFiles());
         if ($this->form->isValid()) {
             if (null !== ($file = $this->form->getValue('file'))) {
                 $doc = new domDocument();
                 $doc->substituteEntities = true;
                 $doc->load($file->getTempName());
                 $this->skos = sfSkosPlugin::parse($doc, array('taxonomy' => $this->taxonomy, 'parent' => $this->parent));
             }
         }
     } else {
         $this->setTemplate('importSelect');
     }
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:40,代码来源:importAction.class.php

示例5: generate

 public function generate()
 {
     $this->errors = array();
     $this->generatedMaps = array();
     $doc = new domDocument();
     $doc->load($this->fileXMI);
     $this->xpath = new DOMXpath($doc);
     $this->parse($doc);
     $this->handleAssociation();
     $this->handleAssociationClass();
     $this->handleClassPK();
     $this->handleClassModule();
     $this->handleClassComment();
     $this->handleClassGeneralization();
     $elements = $this->xpath->query("//ownedMember[@name='{$this->package}']/ownedMember[@xmi:type='uml:Class'] | " . " //ownedMember[@name='{$this->package}']/ownedMember[@xmi:type='uml:AssociationClass'] | " . " //ownedMember[@name='{$this->package}']/ownedMember[@xmi:type='uml:Enumeration'] ");
     if ($elements->length > 0) {
         $this->handleClass($elements);
         //$this->handleAssociativeClass();
     } else {
         throw new Exception("Não foi possível encontrar o Package {$this->package} no arquivo XMI.", 1);
     }
 }
开发者ID:joshuacoddingyou,项目名称:php,代码行数:22,代码来源:MWizardXMIScript.php

示例6: generate

 public function generate()
 {
     $this->errors = array();
     $this->generatedMaps = array();
     $doc = new domDocument();
     $doc->load($this->fileXMI);
     $this->xpath = new DOMXpath($doc);
     // example 1: for everything with an id
     //$elements = $xpath->query("//*[@id]");
     // example 2: for node data in a selected id
     //$elements = $xpath->query("/html/body/div[@id='yourTagIdHere']");
     // example 3: same as above with wildcard
     $this->parse($doc);
     $this->handleAssociation();
     $this->handleClassPK();
     $this->handleClassModule();
     $this->handleClassComment();
     $this->handleClassGeneralization();
     $elements = $this->xpath->query("//ownedMember[@name='{$this->package}']/ownedMember[@xmi:type='uml:Class']");
     if ($elements->length > 0) {
         $this->handleClass($elements);
         $this->handleAssociativeClass();
     }
 }
开发者ID:joshuacoddingyou,项目名称:php,代码行数:24,代码来源:MWizardORM.php

示例7: domDocument

<?php

$dom = new domDocument();
$dom->load("book.xml");
if (!$dom) {
    echo "Error while parsing the document\n";
    exit;
}
print "As SimpleXML\n";
$s = simplexml_import_dom($dom);
$books = $s->book;
foreach ($books as $book) {
    echo "{$book->title} was written by {$book->author}\n";
}
print "As DOM \n";
$dom = dom_import_simplexml($s);
$books = $dom->getElementsByTagName("book");
foreach ($books as $book) {
    $title = $book->getElementsByTagName("title");
    $author = $book->getElementsByTagName("author");
    echo $title[0]->firstChild->data . " was written by " . $author[0]->firstChild->data . "\n";
}
开发者ID:cefalo19,项目名称:php-src,代码行数:22,代码来源:interop.php

示例8: domDocument

<?php

$dom = new domDocument();
$dom->load('note.xml');
if (!$dom->validate('note.dtd')) {
    print "Document note.dtd is not valid\n";
} else {
    print "Document note.dtd is valid\n";
}
$dom = new domDocument();
$dom->load('note-invalid.xml');
if (!$dom->validate('note.dtd')) {
    print "Document note-invalid.xml is not valid\n";
} else {
    print "Document note-invalid.xml is valid\n";
}
开发者ID:cefalo19,项目名称:php-src,代码行数:16,代码来源:note.php

示例9: getExtendedValue

 public function getExtendedValue($extKey, $value, $config, $row)
 {
     if (isset($config) && is_array($config) && isset($row['cnum'])) {
         foreach ($config as $key => $lineConfig) {
             if (isset($lineConfig) && is_array($lineConfig) && isset($lineConfig['uid']) && isset($lineConfig['file'])) {
                 $dataFilename = $GLOBALS['TSFE']->tmpl->getFileName($lineConfig['file']);
                 $absFilename = t3lib_div::getFileAbsFileName($dataFilename);
                 $handle = fopen($absFilename, 'rt');
                 if ($handle === FALSE) {
                     throw new Exception($extKey . ': File not found ("' . $absFilename . '")');
                 } else {
                     // Dateityp bestimmen
                     $basename = basename($dataFilename);
                     $posFileExtension = strrpos($basename, '.');
                     $fileExtension = substr($basename, $posFileExtension + 1);
                     if ($fileExtension == 'xml') {
                         $objDom = new domDocument();
                         $objDom->encoding = 'utf-8';
                         $resultLoad = $objDom->load($absFilename, LIBXML_COMPACT);
                         if ($resultLoad) {
                             $bRowFits = FALSE;
                             $objRows = $objDom->getElementsByTagName('Row');
                             foreach ($objRows as $myRow) {
                                 $tag = $myRow->nodeName;
                                 if ($tag == 'Row') {
                                     $objRowDetails = $myRow->childNodes;
                                     $xmlRow = array();
                                     $count = 0;
                                     foreach ($objRowDetails as $rowDetail) {
                                         $count++;
                                         $detailValue = '';
                                         $detailTag = $rowDetail->nodeName;
                                         if ($detailTag != '#text') {
                                             $detailValue = trim($rowDetail->nodeValue);
                                             $xmlRow[$detailTag] = $detailValue;
                                         }
                                         if ($count > 30) {
                                             break;
                                         }
                                     }
                                     // strip off leading zeros
                                     $cnumInput = preg_replace('@^(0*)@', '', $row['cnum']);
                                     $cnumXml = preg_replace('@^(0*)@', '', $xmlRow['cnum']);
                                     if ($cnumInput != '' && $cnumInput == $cnumXml) {
                                         $textArray = array($row['last_name'], $xmlRow['last_name']);
                                         $nameArray = array();
                                         foreach ($textArray as $text) {
                                             $text = strtolower($text);
                                             $text = preg_replace('@\\x{00e4}@u', 'ae', $text);
                                             // umlaut ä => ae
                                             $text = preg_replace('@\\x{00f6}@u', 'oe', $text);
                                             // umlaut ö => oe
                                             $text = preg_replace('@\\x{00fc}@u', 'ue', $text);
                                             // umlaut ü => ue
                                             $nameArray[] = $text;
                                         }
                                         if ($row['email'] == $xmlRow['email']) {
                                             $bRowFits = TRUE;
                                         } else {
                                             if ($nameArray['0'] == $nameArray['1'] && $row['zip'] == $xmlRow['zip']) {
                                                 $bRowFits = TRUE;
                                             }
                                         }
                                     }
                                     if ($bRowFits) {
                                         break;
                                     }
                                 }
                             }
                             if ($bRowFits) {
                                 $value = intval($lineConfig['uid']);
                                 break;
                             }
                         } else {
                             throw new Exception($extKey . ': The file "' . $absFilename . '" is not XML valid.');
                         }
                     } else {
                         throw new Exception($extKey . ': The file "' . $absFilename . '" has an invalid extension.');
                     }
                 }
             }
         }
     }
     return $value;
 }
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:85,代码来源:class.tx_srfeuserregister_model_field_usergroup.php

示例10: XSLTProcessor

<?php

$xslt = new XSLTProcessor();
// Chargement du fichier XML
$xmlDoc = new domDocument();
include 'get.inc';
$xmlDoc->loadXML('<?xml version="1.0" encoding="UTF-8" ?>' . getNodeAsXml($_GET['nodeId']));
// Chargement du fichier XSL
$xsl = new domDocument();
$xsl->load('xmlNodeToJson.xslt');
// Import de la feuille XSL
$xslt->importStylesheet($xsl);
// Transformation et affichage du résultat
echo $xslt->transformToXml($xmlDoc);
开发者ID:BackupTheBerlios,项目名称:cooperativetree-svn,代码行数:14,代码来源:getJson.php

示例11: domDocument

				</tr>
				<tr>
				<td align='center' colspan='2'><input type='checkbox' name='news' id='news'/><label for='news'> Хотите получать новости с сайта?</label></td>
				</tr>
				<tr>
				<td align='center' colspan='2'><input type='submit' value='Отправить'/></td>
				</tr>
			</table>
		</form>
		</div>";
	}
	?>
	<center >
		<?php
			$document = new domDocument();
			$document->load("content.xml");
			$xpath = new domXpath($document);
			if(isset($_REQUEST["view"])){
				$nodelist = $xpath->query("/*/*/".$_REQUEST["view"]."/*");
			}
			else{
				$nodelist = $xpath->query("/*/*/*/*");
			}
			for($i=0; $i<$nodelist->length; $i++){
				$node = $nodelist->item($i);
				$row["$node->nodeName"] = iconv("UTF-8", "CP1251",$node->nodeValue);
				if(($i+1)%4 == 0){
					echo "<a href='".$row["link"]."'><h1>".$row["title"]."</h1></a> 	<img src='".$row["image"]."'/><h3>Описание</h3>".$row["description"]."<br/>";
				
				}					
			}
开发者ID:echmaster,项目名称:data,代码行数:31,代码来源:28+Применение+знаний.php

示例12: domDocument

<?php

$document = new domDocument("1.0", "utf-8");
$document->load("test2.xml");
$nodelist = $document->getElementsByTagName("model");
echo "Количество моделей: <b>" . $nodelist->length . "<b><br/>";
开发者ID:echmaster,项目名称:data,代码行数:6,代码来源:dz.php

示例13: domDocument

<?php

$dom = new domDocument();
$dom->load('relaxNG.xml');
if (!$dom->relaxNGValidate('relaxNG.rng')) {
    print "Document is not valid";
} else {
    print "Document is valid";
}
开发者ID:cefalo19,项目名称:php-src,代码行数:9,代码来源:relaxNG.php

示例14: domDocument

 static function get_elements_used($file = "")
 {
     @ini_set("zend.ze1_compatibility_mode", "0");
     //on récupère la partie intéressante du manifest...
     $dom = new domDocument();
     $dom->load($file);
     $use = $dom->getElementsbyTagName("use")->item(0);
     $elements_used = self::read_elements_used($use);
     @ini_set("zend.ze1_compatibility_mode", "1");
     return $elements_used;
 }
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:11,代码来源:cms_module_common_module.class.php

示例15: domDocument

<?php

$dom = new domDocument();
$dom->load(dirname(__FILE__) . "/area_name.xml");
if (!$dom) {
    echo "Error while parsing the document\n";
    exit;
}
$xsl = new domDocument();
$xsl->load(dirname(__FILE__) . "/area_list.xsl");
if (!$xsl) {
    echo "Error while parsing the document\n";
    exit;
}
$proc = new xsltprocessor();
if (!$proc) {
    echo "Error while making xsltprocessor object\n";
    exit;
}
$proc->importStylesheet($xsl);
print $proc->transformToXml($dom);
//this segfaulted before
print $dom->documentElement->firstChild->nextSibling->nodeName;
开发者ID:badlamer,项目名称:hhvm,代码行数:23,代码来源:bug26384.php


注:本文中的domDocument::load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。