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


PHP XML::parse方法代码示例

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


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

示例1: xml_unserialize

function xml_unserialize(&$xml, $isnormal = FALSE)
{
    $xml_parser = new XML($isnormal);
    $data = $xml_parser->parse($xml);
    $xml_parser->destruct();
    return $data;
}
开发者ID:saintho,项目名称:phpdisk,代码行数:7,代码来源:xml.class.php

示例2: XML_unserialize

function XML_unserialize($xml)
{
    $xml_parser = new XML();
    $data = $xml_parser->parse($xml);
    $xml_parser->destruct();
    return $data;
}
开发者ID:norain2050,项目名称:fanwei_xindai_3.2,代码行数:7,代码来源:xml.php

示例3: unserialize

 public static function unserialize($xml, $isnormal = false)
 {
     $xml_parser = new XML($isnormal);
     $data = $xml_parser->parse($xml);
     $xml_parser->destruct();
     return $data;
 }
开发者ID:tenstone,项目名称:ucenter-client,代码行数:7,代码来源:SerializerXml.php

示例4: xml_unserialize

function xml_unserialize(&$xml)
{
    $xml_parser = new XML();
    $data = $xml_parser->parse($xml);
    $xml_parser->destruct();
    $arr = xml_format_array($data);
    return $arr['root'];
}
开发者ID:dalinhuang,项目名称:shopexts,代码行数:8,代码来源:xml.class.php

示例5: XML

function &XML_unserialize(&$xml)
{
    //$xml_parser = &new XML();
    $xml_parser = new XML();
    $data =& $xml_parser->parse($xml);
    $xml_parser->destruct();
    return $data;
}
开发者ID:aim-web-projects,项目名称:ann-cosme,代码行数:8,代码来源:_xml.php

示例6: leer

 function leer($oc)
 {
     session_start();
     //$xml_file="./demo.xml";
     $xml_file = "./OC/Orden_" . $oc . ".xml";
     #$xml_data=implode("",file($xml_file)); //get XML data for alternative direct parsing
     $xml = new XML();
     $xml->file_read($xml_file);
     #$xml->parse($xml_data); //parse direct XML data
     $xml->parse();
     #$xml->debug();
     //Samples...
     //echo $xml->demo->tag1->_param["say"];
     //echo $xml->demo->tag4->item[1]->_value;
     $_SESSION["numoc"] = $oc;
     $fecha = $xml->OrdersResults->OrdersList->Order->OrderHeader->OrderDates->PromiseDate->_value;
     $fechaoc = explode("T", $fecha);
     $_SESSION["fechaoc"] = $fechaoc[0];
     $_SESSION["depto"] = $xml->OrdersResults->OrdersList->Order->OrderHeader->OrderParty->BuyerParty->NameAddress->Name1->_value;
     $rut = $xml->OrdersResults->OrdersList->Order->OrderHeader->OrderParty->SellerParty->PartyID->Ident->_value;
     $r = explode(".", $rut);
     $rut2 = $r[0] . $r[1] . $r[2];
     $r2 = explode("-", $rut2);
     $_SESSION["rutp1"] = $r2[0];
     $_SESSION["rutp2"] = $r2[1];
     $_SESSION["namep"] = $xml->OrdersResults->OrdersList->Order->OrderHeader->OrderParty->SellerParty->NameAddress->Name1->_value;
     $_SESSION["direccionp"] = $xml->OrdersResults->OrdersList->Order->OrderHeader->OrderParty->SellerParty->NameAddress->District->_value;
     $_SESSION["ciudadp"] = $xml->OrdersResults->OrdersList->Order->OrderHeader->OrderParty->SellerParty->NameAddress->City->_value;
     $_SESSION["contactop"] = $xml->OrdersResults->OrdersList->Order->OrderHeader->OrderParty->SellerParty->PrimaryContact->ContactName->_value;
     $_SESSION["telefonop"] = $xml->OrdersResults->OrdersList->Order->OrderHeader->OrderParty->SellerParty->PrimaryContact->ListOfContactNumber->ContactNumber[1]->ContactNumberValue->_value;
     $_SESSION["solicitante"] = $xml->OrdersResults->OrdersList->Order->OrderHeader->OrderParty->BuyerParty->PrimaryContact->ContactName->_value;
     $_SESSION["Total"] = $xml->OrdersResults->OrdersList->Order->OrderSummary->OrderTotal->MonetaryAmount->_value;
     $_SESSION["neto"] = $xml->OrdersResults->OrdersList->Order->OrderSummary->OrderSubTotal->MonetaryAmount->_value;
     $size = $xml->OrdersResults->OrdersList->Order->OrderSummary->NumberOfLines->_value;
     $_SESSION["size"] = $size;
     $list = array();
     if ($size == 1) {
         $name = $xml->OrdersResults->OrdersList->Order->OrderDetail->ListOfItemDetail->ItemDetail->BaseItemDetail->ItemIdentifiers->ItemDescription->_value;
         $cantidad = $xml->OrdersResults->OrdersList->Order->OrderDetail->ListOfItemDetail->ItemDetail->BaseItemDetail->TotalQuantity->QuantityValue->_value;
         $preciou = $xml->OrdersResults->OrdersList->Order->OrderDetail->ListOfItemDetail->ItemDetail->PricingDetail->ListOfPrice->Price->UnitPrice->UnitPriceValue->_value;
         $preciot = $xml->OrdersResults->OrdersList->Order->OrderDetail->ListOfItemDetail->ItemDetail->PricingDetail->LineItemTotal->MonetaryAmount->_value;
         $list[0] = array($name, $cantidad, $preciou, $preciot);
     } else {
         for ($i = 0; $i < $size; $i++) {
             $name = $xml->OrdersResults->OrdersList->Order->OrderDetail->ListOfItemDetail->ItemDetail[$i]->BaseItemDetail->ItemIdentifiers->ItemDescription->_value;
             $cantidad = $xml->OrdersResults->OrdersList->Order->OrderDetail->ListOfItemDetail->ItemDetail[$i]->BaseItemDetail->TotalQuantity->QuantityValue->_value;
             $preciou = $xml->OrdersResults->OrdersList->Order->OrderDetail->ListOfItemDetail->ItemDetail[$i]->PricingDetail->ListOfPrice->Price->UnitPrice->UnitPriceValue->_value;
             $preciot = $xml->OrdersResults->OrdersList->Order->OrderDetail->ListOfItemDetail->ItemDetail[$i]->PricingDetail->LineItemTotal->MonetaryAmount->_value;
             $list[$i] = array($name, $cantidad, $preciou, $preciot);
         }
     }
     $_SESSION["list"] = $list;
     /*echo "<hr />";
     foreach($xml->demo->tag2->text as $key=>$value){
     	echo "$key = $value->_value<br />";
     }*/
 }
开发者ID:robertoesteban,项目名称:Sistema-de-Bodega,代码行数:57,代码来源:LeerXML.php

示例7: testParse

    /**
     * @covers jarekkozak\kie\XML::parse
     */
    public function testParse()
    {
        $a = '<execution-results>
  <result identifier="response">
    <query-results>
      <identifiers>
        <identifier>r</identifier>
      </identifiers>
      <row>
        <trimetis.heartbeat.Response>
          <output>HeartBeat</output>
          <responseDate>2015-06-01 20:07:01.111 UTC</responseDate>
        </trimetis.heartbeat.Response>
        <fact-handle external-form="0:2:1059301429:1059301429:2:DEFAULT:NON_TRAIT"/>
      </row>
      <row>
        <trimetis.heartbeat.Response>
          <output>I&apos;m alive</output>
          <responseDate>2015-06-01 20:07:01.463 UTC</responseDate>
        </trimetis.heartbeat.Response>
        <fact-handle external-form="0:3:1039683573:1039683573:3:DEFAULT:NON_TRAIT"/>
      </row>
    </query-results>
  </result>
  <result identifier="hb_request">
    <trimetis.heartbeat.Request>
      <message>HeartBeat</message>
      <time reference="../../../result/query-results/row/trimetis.heartbeat.Response/responseDate"/>
      <start>2015-06-01 20:07:01.0 UTC</start>
    </trimetis.heartbeat.Request>
  </result>
  <fact-handle identifier="hb_request" external-form="0:1:1126511283:1126511283:1:DEFAULT:NON_TRAIT"/>
</execution-results>';
        $expected = json_decode(json_encode((array) simplexml_load_string($a)), TRUE);
        self::assertTrue(isset($expected['result'][1]['trimetis.heartbeat.Request']['time']['@attributes']['reference']));
        self::assertEquals("../../../result/query-results/row/trimetis.heartbeat.Response/responseDate", $expected['result'][1]['trimetis.heartbeat.Request']['time']['@attributes']['reference']);
        self::assertEquals(['@attributes' => ['reference' => "../../../result/query-results/row/trimetis.heartbeat.Response/responseDate"]], $expected['result'][1]['trimetis.heartbeat.Request']['time']);
        $parser = new XML();
        $result = $parser->parse($a);
        self::assertFalse(isset($result['result'][1]['trimetis.heartbeat.Request']['time']['@attributes']['reference']));
        self::assertEquals("2015-06-01 20:07:01.111 UTC", $result['result'][1]['trimetis.heartbeat.Request']['time']);
        //"../../../result/query-results/row/trimetis.heartbeat.Response/responseDate"
        //$result[1]['trimetis.heartbeat.Request']['time']
    }
开发者ID:jarekkozak,项目名称:yii2-libs,代码行数:47,代码来源:XMLTest.php

示例8: XML

function &XML_unserialize(&$xml)
{
    $xml_parser = new XML();
    $data = $xml_parser->parse(&$xml);
    $xml_parser->destruct();
    $refdata =& $data;
    return $refdata;
}
开发者ID:kldeepak,项目名称:swara,代码行数:8,代码来源:xmlrpc.php

示例9: getResults

 /**
  * Gets rule execution results
  * @return boolean
  */
 public function getResults()
 {
     if (!$this->response->isSuccess()) {
         return FALSE;
     }
     $data = $this->response->getData()['results'];
     \Yii::trace("KieContainer get result: {$data}", __METHOD__);
     $parser = new XML();
     return $parser->parse($data);
 }
开发者ID:jarekkozak,项目名称:yii2-libs,代码行数:14,代码来源:KieContainer.php

示例10: adminmsg

        exit;
    } else {
        S::gp(array('ymail'), 'P');
        if (!$ymail || !preg_match('/^[a-zA-Z][a-zA-Z0-9_]{3,31}\\@(yahoo\\.com\\.cn|yahoo\\.cn)$/', $ymail)) {
            adminmsg('ystat_ymail_format');
        }
        L::loadClass('xml', 'utility', false);
        $xml = new XML();
        $xml->setEncode('UTF-8');
        $response = PostHost($ystatsUrl . '/reg.html?type=3&key=' . $db_ystats_key . '&unit_id=' . $db_ystats_unit_id . '&ymail=' . $ymail);
        $response && ($response = chunkdecode($response));
        $xml->setXMLData($response);
        if (!$xml->isXMLFile()) {
            adminmsg('ystat_xmldata_error');
        }
        $xml->parse();
        $ystats = array();
        $result = XML::getChild($xml->getXMLRoot());
        foreach ($result as $tag) {
            $tagname = XML::getTagName($tag);
            $ystats[$tagname] = XML::getData($tag);
        }
        if ($ystats['status'] != '0') {
            adminmsg($ystats['info']);
        }
        setConfig('db_ystats_ymail', $ymail);
        updatecache_c();
        adminmsg('operate_success');
    }
} elseif ($action == 'reactivate') {
    $db->update("UPDATE pw_config SET db_value='',vtype='string' WHERE db_name IN('db_ystats_ymail','db_ystats_ifopen','db_ystats_style','db_ystats_unit_id','db_ystats_key')");
开发者ID:jechiy,项目名称:PHPWind,代码行数:31,代码来源:ystats.php

示例11: decryptMsg

 /**
  * 检验消息的真实性,并且获取解密后的明文.
  * <ol>
  *    <li>利用收到的密文生成安全签名,进行签名验证</li>
  *    <li>若验证通过,则提取xml中的加密消息</li>
  *    <li>对消息进行解密</li>
  * </ol>
  *
  * @param string $msgSignature  签名串,对应URL参数的msg_signature
  * @param string $timestamp     时间戳 对应URL参数的timestamp
  * @param string $nonce         随机串,对应URL参数的nonce
  * @param string $postXML       密文,对应POST请求的数据
  * @param string &$msg          解密后的原文,当return返回0时有效
  *
  * @return array
  */
 public function decryptMsg($msgSignature, $nonce, $timestamp, $postXML)
 {
     //提取密文
     $array = XML::parse($postXML);
     if (empty($array)) {
         throw new Exception('Invalid xml.', self::ERROR_PARSE_XML);
     }
     $encrypted = $array['Encrypt'];
     //验证安全签名
     $signature = $this->getSHA1(Wechat::getOption('token'), $timestamp, $nonce, $encrypted);
     if ($signature != $msgSignature) {
         throw new Exception('Invalid Signature.', self::ERROR_INVALID_SIGNATURE);
     }
     return XML::parse($this->decrypt($encrypted, Wechat::getOption('appId')));
 }
开发者ID:xutongtong,项目名称:wechat,代码行数:31,代码来源:Crypt.php


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