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


PHP DOMDocument::appendchild方法代码示例

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


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

示例1: validate

 function validate()
 {
     if (!($dom_sxe = dom_import_simplexml($this->_xml))) {
         return false;
     }
     $dom = new DOMDocument("1.0");
     $dom_sxe = $dom->importnode($dom_sxe, true);
     $dom_sxe = $dom->appendchild($dom_sxe);
     return $dom->relaxNGValidate();
 }
开发者ID:BackupTheBerlios,项目名称:papyrine-svn,代码行数:10,代码来源:PapyrinePlugin.php

示例2: toQueueXML

 public function toQueueXML()
 {
     $dom = new \DOMDocument("1.0", "utf-8");
     $dom->formatOutput = TRUE;
     $root = $dom->createElement("Queue");
     //创建根节点
     $dom->appendchild($root);
     $price = $dom->createAttribute("xmlns");
     $root->appendChild($price);
     $priceValue = $dom->createTextNode('http://mqs.aliyuncs.com/doc/v1/');
     $price->appendChild($priceValue);
     foreach ($this->attributes as $k => $v) {
         $queue = $dom->createElement($k);
         $root->appendChild($queue);
         $titleText = $dom->createTextNode($v);
         $queue->appendChild($titleText);
     }
     return $dom->saveXML();
 }
开发者ID:xjtuwangke,项目名称:laravel-bundles,代码行数:19,代码来源:QueueConfig.php

示例3: generatexml

 private function generatexml($msgbody, $DelaySeconds = 0, $Priority = 8)
 {
     header('Content-Type: text/xml;');
     $dom = new DOMDocument("1.0", "utf-8");
     $dom->formatOutput = TRUE;
     $root = $dom->createElement("Message");
     //创建根节点
     $dom->appendchild($root);
     $price = $dom->createAttribute("xmlns");
     $root->appendChild($price);
     $priceValue = $dom->createTextNode('http://mqs.aliyuncs.com/doc/v1/');
     $price->appendChild($priceValue);
     $msg = array('MessageBody' => $msgbody, 'DelaySeconds' => $DelaySeconds, 'Priority' => $Priority);
     foreach ($msg as $k => $v) {
         $msg = $dom->createElement($k);
         $root->appendChild($msg);
         $titleText = $dom->createTextNode($v);
         $msg->appendChild($titleText);
     }
     return $dom->saveXML();
 }
开发者ID:huqq1987,项目名称:clone-lemon,代码行数:21,代码来源:alimqs.class.php

示例4: searchRetrieveRequest

 public function searchRetrieveRequest($params)
 {
     $finna = new Finna();
     if (!isset($params['maximumRecords'])) {
         $limit = 0;
     } else {
         $limit = $params['maximumRecords'];
     }
     if (!empty($params['x-pquery'])) {
         $params['query'] = $params['x-pquery'];
     }
     $apiParams = array('limit' => $limit);
     if (!empty($params['startRecord'])) {
         $apiParams['page'] = $params['startRecord'];
     }
     $finnaResults = $finna->search($params['query'], $apiParams);
     $dom = new DOMDocument('1.0', 'UTF-8');
     $xmlRoot = $dom->createElementNS('http://docs.oasis-open.org/ns/search-ws/sruResponse', 'zs:searchRetrieveResponse');
     $xmlRoot = $dom->appendchild($xmlRoot);
     $numberOfRecords = $dom->createElement('zs:numberOfRecords', $finnaResults['resultCount']);
     $xmlRoot->appendChild($numberOfRecords);
     if (!empty($finnaResults['records'])) {
         $records = $dom->createElement('zs:records');
         $positionIndex = 1;
         foreach ($finnaResults['records'] as $record) {
             $domRecord = new DOMDocument();
             $domRecord->loadXML($record['fullRecord']);
             if (!$domRecord) {
                 Log::write('corrupted XML');
                 Log::write(print_r($record, 1));
                 break;
             }
             $recordList = $domRecord->getElementsByTagName('record');
             if (!$recordList->length) {
                 Log::write('unexpected result, no records found');
                 Log::write(print_r($record, 1));
                 break;
             }
             $importedRecord = $dom->importNode($recordList->item(0), true);
             $ourRecord = $dom->createElement('zs:record');
             $recordXMLEscaping = $dom->createElement('zs:recordXMLEscaping', 'xml');
             $ourRecord->appendChild($recordXMLEscaping);
             $recordSchema = $dom->createElement('zs:recordSchema');
             $ourRecord->appendChild($recordSchema);
             $recordData = $dom->createElement('zs:recordData');
             $recordData->appendChild($importedRecord);
             $ourRecord->appendChild($recordData);
             $recordPosition = $dom->createElement('zs:recordPosition', $positionIndex);
             $ourRecord->appendChild($recordPosition);
             $records->appendChild($ourRecord);
             $positionIndex++;
         }
         $xmlRoot->appendChild($records);
     }
     $echoedRequest = $dom->createElement('zs:echoedSearchRetrieveRequest');
     foreach ($params as $key => $value) {
         $element = $dom->createElement('zs:' . $key, $value);
         $echoedRequest->appendchild($element);
     }
     $xmlRoot->appendChild($echoedRequest);
     return $dom->saveXML();
 }
开发者ID:onre,项目名称:finna-proxy,代码行数:62,代码来源:Api.php

示例5: generatequeuexml

 private function generatequeuexml($queue = array())
 {
     header('Content-Type: text/xml;');
     $dom = new DOMDocument("1.0", "utf-8");
     $dom->formatOutput = TRUE;
     $root = $dom->createElement("Queue");
     //创建根节点
     $dom->appendchild($root);
     $price = $dom->createAttribute("xmlns");
     $root->appendChild($price);
     $priceValue = $dom->createTextNode('http://mqs.aliyuncs.com/doc/v1/');
     $price->appendChild($priceValue);
     foreach ($queue as $k => $v) {
         $queue = $dom->createElement($k);
         $root->appendChild($queue);
         $titleText = $dom->createTextNode($v);
         $queue->appendChild($titleText);
     }
     return $dom->saveXML();
 }
开发者ID:lizhengqiang,项目名称:thinkphp,代码行数:20,代码来源:Queue.class.php

示例6: DOMDocument

<?php

$dom = new DOMDocument('1.0');
$books = $dom->appendchild($dom->CreateElement('books'));
$book = $books->appendchild($dom->CreateElement('book'));
$title = $book->appendchild($dom->createElement('title'));
$title->appendchild($dom->createTextNode('visual studio.net'));
$authar = $books->appendchild($dom->createelement('authar'));
$authar->appendchild($dom->createtextnode('.net'));
$dom->formatoutput = true;
$test1 = $dom->savexml();
$dom->save('exam6.xml');
开发者ID:chiragbutani,项目名称:PHP-Practice-Program,代码行数:12,代码来源:Pro6.php

示例7: header

    header('last-modified: ' . date('r'));
    header('pragma:no-cache');
    $dom = new DOMDocument('1.0');
    if (file_exists('guesebook.xml')) {
        $gb = simplexml_load_file('guesebook.xml');
        foreach ($gb->item as $item) {
            $gbit_arry[] = (int) $item->id;
        }
        $gbid = max($gbit_arry) + 1;
        $gb = dom_import_simplexml($gb);
        $gb = $dom->importnode($gb, true);
    } else {
        $gb = $dom->createelement('guestbook');
        $gbid = 1;
    }
    $gb = $dom->appendchild($gb);
    $item = $dom->createelement("item");
    //id
    $id = $dom->createelement('id');
    $text = $dom->createtextnode($gbid);
    $id->appendchild($text);
    $id = $item->appendchild($id);
    $user = $dom->createelement('user');
    $text = $dom->createtextnode(trim($_POST['user']));
    $user->appendchild($text);
    $user = $item->appendchild($user);
    $item = $gb->appendchild($item);
    echo $dom->saveXML();
    $dom->save("guestbook.xml");
}
?>
开发者ID:shiyake,项目名称:PHP,代码行数:31,代码来源:guestbook.php

示例8: trim

 $clean_api_secret = trim($_POST['secret_key']);
 if ($clean_api_key != "" && $clean_api_secret != "") {
     $response = @file_get_contents('https://rest.nexmo.com/account/numbers/' . $clean_api_key . '/' . $clean_api_secret);
     //fetching from number
     $msg_from = (array) json_decode($response);
     if (isset($msg_from['numbers'][0]->msisdn) && $msg_from['numbers'][0]->msisdn != "") {
         //
         $nexmo_key = $clean_api_key;
         $secret_key = $clean_api_secret;
         $from_number = $msg_from['numbers'][0]->msisdn;
         $campaign_monitor = $_POST['campaign_monitor'];
         $phone_number_field = $_POST['phone_number_field'];
         $doc = new DOMDocument();
         $doc->formatOutput = true;
         $s = $doc->createElement("settings");
         $doc->appendchild($s);
         $r = $doc->createElement("nexmo");
         $doc->appendChild($r);
         $api = $doc->createElement("api");
         $api->appendChild($doc->createTextNode($nexmo_key));
         $r->appendChild($api);
         $secretkey = $doc->createElement("secretkey");
         $secretkey->appendChild($doc->createTextNode($secret_key));
         $r->appendChild($secretkey);
         $fromnumber = $doc->createElement("fromnumber");
         $fromnumber->appendChild($doc->createTextNode($from_number));
         $r->appendChild($fromnumber);
         $s->appendChild($r);
         $b = $doc->createElement("campaignmonitor");
         $doc->appendChild($b);
         $api = $doc->createElement("api");
开发者ID:AdvaiyaLabs,项目名称:Campaign-Monitor-with-Nexmo-SMS,代码行数:31,代码来源:saveConfiguration_details.php


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