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


PHP XML::xpath方法代码示例

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


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

示例1: header

<?php

/*
  This file is part of WOT Game.

    WOT Game is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    WOT Game is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with WOT Game.  If not, see <http://www.gnu.org/licenses/>.
*/
define('INSIDE', true);
$ugamela_root_path = '../';
include $ugamela_root_path . 'extension.inc';
include $ugamela_root_path . 'common.' . $phpEx;
if (!check_user()) {
    header("Location: login.php");
    die;
}
$fileName = FileUtil::downloadFileFromHttp('http://neu.lost-worlds.de/game/index.php?page=XMLStatistics', 'statistics');
$xmlObj = new XML($fileName);
$arr = $xmlObj->xpath('./*[@userID="156"]');
var_dump($arr);
开发者ID:sonicmaster,项目名称:RPG,代码行数:30,代码来源:xmltest.php

示例2: checkResponseForError

 /**
  * Throw an exception if an NCIP error is found
  *
  * @param XML $response from NCIP call
  *
  * @throws ILSException
  * @return void
  */
 protected function checkResponseForError($response)
 {
     $error = $response->xpath('//ns1:Problem/ns1:ProblemDetail');
     if (!empty($error)) {
         throw new ILSException($error[0]);
     }
 }
开发者ID:datavoyager,项目名称:vufind,代码行数:15,代码来源:XCNCIP2.php

示例3: is_keyword

 /**
  * This function checks whether the specified token is a reserved keyword.
  *
  * @access public
  * @static
  * @param string $token                         the token to be cross-referenced
  * @return boolean                              whether the token is a reserved keyword
  *
  * @see http://www.postgresql.org/docs/7.3/static/sql-keywords-appendix.html
  */
 public static function is_keyword($token)
 {
     if (static::$xml === NULL) {
         static::$xml = XML::load('config/sql/postgresql.xml');
     }
     $token = strtoupper($token);
     $nodes = static::$xml->xpath("/sql/dialect[@name='postgresql' and @version='7.3']/keywords[keyword = '{$token}']");
     return !empty($nodes);
 }
开发者ID:ruslankus,项目名称:invoice-crm,代码行数:19,代码来源:Precompiler.php

示例4: loadPlanetData

 /**
  * Loads the planet data
  */
 protected function loadPlanetData()
 {
     global $resource;
     $fileName = $this->getReport();
     if ($fileName == '') {
         return;
     }
     $xmlObj = new XML($fileName);
     // fleet
     for ($i = 200; $i < 500; ++$i) {
         if (!isset($resource[$i])) {
             continue;
         }
         $array = $xmlObj->xpath('//*[@id="' . $i . '"]');
         if (!isset($array[0][0])) {
             continue;
         }
         $this->defenderFleets[1]['fleet'][$i] = intval(str_replace(WCF::getLanguage()->get('wcf.global.thousandsSeparator'), '', $array[0][0]));
     }
     // tech
     for ($i = 109; $i <= 111; ++$i) {
         if (!isset($resource[$i])) {
             continue;
         }
         $array = $xmlObj->xpath('//*[@id="' . $i . '"]');
         if (!isset($array[0][0])) {
             continue;
         }
         $this->defenderFleets[1]['tech'][$i] = intval(str_replace(WCF::getLanguage()->get('wcf.global.thousandsSeparator'), '', $array[0][0]));
     }
     // own techs
     $this->attackerFleets[1]['tech'][109] = LWCore::getUser()->military_tech;
     $this->attackerFleets[1]['tech'][110] = LWCore::getUser()->defence_tech;
     $this->attackerFleets[1]['tech'][111] = LWCore::getUser()->shield_tech;
 }
开发者ID:sonicmaster,项目名称:RPG,代码行数:38,代码来源:SimulatorForm.class.php


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