當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。