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


PHP SimpleXMLElement::saveXML方法代码示例

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


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

示例1: create

 /**
  * @param $arguments \Wave\Framework\Application\Contexts\ArgumentsContext
  * @param $context \Wave\Framework\Storage\Registry
  */
 public function create($arguments, $context)
 {
     $config = $context->get('config');
     $via = $arguments->get('methods');
     list($controller, $method) = explode(';', trim($arguments->get('callback'), '"'));
     $module = $arguments->get('module');
     $pattern = $config['modules'][$module] . implode('/', $arguments->get('pattern'));
     if (!is_null($module) && is_readable(sprintf(getcwd() . '/application/modules/%s.xml', $module))) {
         $xml = new \SimpleXMLElement(sprintf(getcwd() . '/application/modules/%s.xml', $module), null, true);
         /**
          * @var $child \SimpleXMLElement
          */
         foreach ($xml->children() as $child) {
             if ($child['pattern'] == $pattern && $child['method'] == $method) {
                 echo sprintf("\t Error route already exists in module '%s'\n\r\n\r", $module);
                 exit(1);
             }
         }
         $route = $xml->addChild('route');
         $route->addAttribute('pattern', $pattern);
         $route->addAttribute('via', $via);
         $route->addAttribute('method', $method);
         $route->addAttribute('controller', $controller);
         if (!is_null($arguments->get('handler'))) {
             $route->addAttribute('handler', $arguments->get('handler'));
         }
         $xml->saveXML(sprintf(getcwd() . '/application/modules/%s.xml', $module));
     }
 }
开发者ID:DaGhostman,项目名称:breeze,代码行数:33,代码来源:ControllerController.php

示例2: setUp

 public function setUp()
 {
     $xml = new SimpleXMLElement('<docblox />');
     $xml->title = self::TITLE;
     $xml->visibility = self::VISIBILITY;
     DocBlox_Core_Abstract::setConfig(new DocBlox_Core_Config($xml->saveXML()));
     $this->fixture = new DocBlox_Task_Project_Parse();
 }
开发者ID:rvanvelzen,项目名称:phpDocumentor2,代码行数:8,代码来源:ParseTest.php

示例3: toString

 /**
  * Convert XML object to string.
  *
  * @param   \SimpleXMLElement|\DOMDocument|string  $data  XML object or data.
  *
  * @return  string  Converted XML string.
  */
 protected function toString($data)
 {
     if ($data instanceof \SimpleXMLElement) {
         return $data->asXML();
     } elseif ($data instanceof \DOMDocument) {
         return $data->saveXML();
     } elseif (is_string($data)) {
         return $data;
     }
     throw new \InvalidArgumentException(sprintf('Invalid XML content type, %s provided.', gettype($data)));
 }
开发者ID:ventoviro,项目名称:windwalker-http,代码行数:18,代码来源:XmlResponse.php

示例4: xmlconfig

 private function xmlconfig($mac)
 {
     $this->gsgeral();
     $this->gsuser($mac);
     $xml = new SimpleXMLElement("<?xml version='1.0' encoding='utf-8'?><gs_provision/>");
     $xml->addAttribute('version', '1');
     $xml->addChild("mac", $mac);
     $xml->addChild("config")->addAttribute('version', '1');
     foreach ($this->gsconfig as $k => $v) {
         $xml->config->addChild($k, $v);
     }
     $this->output->set_content_type('application/xml')->set_output($xml->saveXML());
 }
开发者ID:guicardoso,项目名称:provisioner,代码行数:13,代码来源:Gs.php

示例5: prepareRequest

 /**
  * @see uspsQuery::prepareRequest()
  */
 protected function prepareRequest()
 {
     $xml = new SimpleXMLElement('<TrackRequest/>');
     $xml->addAttribute('USERID', $this->plugin->user_id);
     $track = $xml->addChild('TrackID');
     if ($this->plugin->test_mode) {
         // test request
         // @see https://www.usps.com/business/web-tools-apis/delivery-information.htm
         $track->addAttribute('ID', 'EJ958083578US');
     } else {
         $track->addAttribute('ID', $this->params['tracking_id']);
     }
     return $xml->saveXML();
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:17,代码来源:uspsTrackingQuery.class.php

示例6: adrotate_export_ads

function adrotate_export_ads($ids, $format)
{
    global $wpdb;
    $all_ads = $wpdb->get_results("SELECT * FROM `{$wpdb->prefix}adrotate` ORDER BY `id` ASC;", ARRAY_A);
    $ads = array();
    foreach ($all_ads as $single) {
        if (in_array($single['id'], $ids)) {
            $starttime = $stoptime = 0;
            $starttime = $wpdb->get_var("SELECT `starttime` FROM `{$wpdb->prefix}adrotate_schedule`, `{$wpdb->prefix}adrotate_linkmeta` WHERE `ad` = '" . $single['id'] . "' AND `schedule` = `{$wpdb->prefix}adrotate_schedule`.`id` ORDER BY `starttime` ASC LIMIT 1;");
            $stoptime = $wpdb->get_var("SELECT `stoptime` FROM `{$wpdb->prefix}adrotate_schedule`, `{$wpdb->prefix}adrotate_linkmeta` WHERE `ad` = '" . $single['id'] . "' AND  `schedule` = `{$wpdb->prefix}adrotate_schedule`.`id` ORDER BY `stoptime` DESC LIMIT 1;");
            if (!is_array($single['cities'])) {
                $single['cities'] = array();
            }
            if (!is_array($single['countries'])) {
                $single['countries'] = array();
            }
            $ads[$single['id']] = array('title' => $single['title'], 'bannercode' => stripslashes($single['bannercode']), 'imagetype' => $single['imagetype'], 'image' => $single['image'], 'tracker' => $single['tracker'], 'mobile' => $single['mobile'], 'tablet' => $single['tablet'], 'responsive' => $single['responsive'], 'weight' => $single['weight'], 'budget' => $single['budget'], 'crate' => $single['crate'], 'irate' => $single['irate'], 'cities' => implode(',', maybe_unserialize($single['cities'])), 'countries' => implode(',', maybe_unserialize($single['countries'])), 'start' => $starttime, 'end' => $stoptime);
        }
    }
    if ($ads) {
        $filename = "AdRotate_export_" . date_i18n("mdYHi") . "_" . uniqid() . ".xml";
        $xml = new SimpleXMLElement('<adverts></adverts>');
        foreach ($ads as $ad) {
            $node = $xml->addChild('advert');
            $node->addChild('title', $ad['title']);
            $node->addChild('bannercode', $ad['bannercode']);
            $node->addChild('imagetype', $ad['imagetype']);
            $node->addChild('image', $ad['image']);
            $node->addChild('tracker', $ad['tracker']);
            $node->addChild('mobile', $ad['mobile']);
            $node->addChild('tablet', $ad['tablet']);
            $node->addChild('responsive', $ad['responsive']);
            $node->addChild('weight', $ad['weight']);
            $node->addChild('budget', $ad['budget']);
            $node->addChild('crate', $ad['crate']);
            $node->addChild('irate', $ad['irate']);
            $node->addChild('cities', $ad['cities']);
            $node->addChild('countries', $ad['countries']);
            $node->addChild('start', $ad['start']);
            $node->addChild('end', $ad['end']);
        }
        file_put_contents(WP_CONTENT_DIR . '/reports/' . $filename, $xml->saveXML());
        unset($all_ads, $ads);
        adrotate_return('adrotate-ads', 215, array('file' => $filename));
        exit;
    } else {
        adrotate_return('adrotate-ads', 509);
    }
}
开发者ID:vanlong200880,项目名称:tmdt,代码行数:49,代码来源:adrotate-export.php

示例7: __construct

 public function __construct(SimpleXMLElement $xml = null)
 {
     if (!$xml) {
         return;
     }
     foreach ($xml->children() as $nodeName => $node) {
         if (!is_null($this->{$nodeName})) {
             continue;
         }
         $type = $this->getAttributeType($nodeName);
         if (is_null($type)) {
             throw new WebexXmlException("No type found for " . get_class($this) . "->{$nodeName}, XML: " . $xml->saveXML());
         }
         $this->{$nodeName} = $this->getAttributeValue($type, $xml->xpath($nodeName));
     }
     //		foreach($xml->attributes($prefix, true) as $attributeName => $attribute)
     //			$this->attributes[$attributeName] = strval($attribute);
 }
开发者ID:DBezemer,项目名称:server,代码行数:18,代码来源:WebexXmlObject.class.php

示例8: setXml

 /**
  * Set the Xml
  *
  * @param SimpleXMLElement $xml OSM XML
  *
  * @return Services_OpenStreetMap_Relation
  */
 public function setXml(SimpleXMLElement $xml)
 {
     $this->xml = $xml->saveXML();
     $obj = $xml->xpath('//' . $this->getType());
     foreach ($obj[0]->children() as $child) {
         $childname = $child->getName();
         if ($childname == 'tag') {
             $key = (string) $child->attributes()->k;
             if ($key != '') {
                 $this->tags[$key] = (string) $child->attributes()->v;
             }
         } elseif ($childname == 'member') {
             $this->members[] = array('type' => (string) $child->attributes()->type, 'ref' => (string) $child->attributes()->ref, 'role' => (string) $child->attributes()->role);
         }
     }
     $this->obj = $obj;
     return $this;
 }
开发者ID:AndrOrt,项目名称:Services_Openstreetmap,代码行数:25,代码来源:Relation.php

示例9: newAction

 /**
  * @param Request $request
  * @return string|\Symfony\Component\HttpFoundation\RedirectResponse
  * @throws
  */
 public function newAction(Request $request)
 {
     $createNewFileForm = new NewFileForm($this->app['form.factory']);
     $newFileForm = $createNewFileForm->createForm();
     if ($request->getMethod() === 'POST') {
         $newFileForm->bind($request);
         if ($newFileForm->isValid()) {
             $filename = $newFileForm->getData();
             $filename = $filename['fileName'];
             $XMLPattern = new \SimpleXMLElement("<?xml version=\"1.0\" encoding=\"utf-8\" ?><YealinkIPPhoneDirectory></YealinkIPPhoneDirectory>");
             if ($XMLPattern->saveXML($this->app['sourceDirectory'] . '/' . $filename . '.xml') !== false) {
                 return $this->app->redirect($this->app['url_generator']->generate('contact', array('name' => $filename . ".xml")));
             } else {
                 throw \Exception("Problem with save file into given directory");
             }
         }
     }
     return $this->twig->render('twigs/Source/new.html.twig', array('newFileForm' => $newFileForm->createView()));
 }
开发者ID:nirav-programmer,项目名称:yealink-phonebook,代码行数:24,代码来源:SourceController.php

示例10: adrotate_export_ads

function adrotate_export_ads($ids)
{
    global $wpdb;
    $all_ads = $wpdb->get_results("SELECT * FROM `" . $wpdb->prefix . "adrotate` ORDER BY `id` ASC;", ARRAY_A);
    $filename = "AdRotate_export_" . date_i18n("mdYHi") . "_" . uniqid() . ".xml";
    $fp = fopen(WP_CONTENT_DIR . '/reports/' . $filename, 'r');
    $xml = new SimpleXMLElement('<adverts></adverts>');
    foreach ($all_ads as $single) {
        if (in_array($single['id'], $ids)) {
            $starttime = $stoptime = 0;
            $starttime = $wpdb->get_var("SELECT `starttime` FROM `" . $wpdb->prefix . "adrotate_schedule`, `" . $wpdb->prefix . "adrotate_linkmeta` WHERE `ad` = '" . $single['id'] . "' AND `schedule` = `" . $wpdb->prefix . "adrotate_schedule`.`id` ORDER BY `starttime` ASC LIMIT 1;");
            $stoptime = $wpdb->get_var("SELECT `stoptime` FROM `" . $wpdb->prefix . "adrotate_schedule`, `" . $wpdb->prefix . "adrotate_linkmeta` WHERE `ad` = '" . $single['id'] . "' AND  `schedule` = `" . $wpdb->prefix . "adrotate_schedule`.`id` ORDER BY `stoptime` DESC LIMIT 1;");
            if (!is_array($single['cities'])) {
                $single['cities'] = array();
            }
            if (!is_array($single['countries'])) {
                $single['countries'] = array();
            }
            $node = $xml->addChild('advert');
            $node->addChild('title', $single['title']);
            $node->addChild('bannercode', stripslashes($single['bannercode']));
            $node->addChild('imagetype', $single['imagetype']);
            $node->addChild('image', $single['image']);
            $node->addChild('link', $single['link']);
            $node->addChild('tracker', $single['tracker']);
            $node->addChild('responsive', $single['responsive']);
            $node->addChild('weight', $single['weight']);
            $node->addChild('budget', $single['budget']);
            $node->addChild('crate', $single['crate']);
            $node->addChild('irate', $single['irate']);
            $node->addChild('cities', implode(',', unserialize($single['cities'])));
            $node->addChild('countries', implode(',', unserialize($single['countries'])));
            $node->addChild('start', $starttime);
            $node->addChild('end', $stoptime);
        }
    }
    file_put_contents(WP_CONTENT_DIR . '/reports/' . $filename, $xml->saveXML());
    adrotate_return('exported', array($filename));
    exit;
}
开发者ID:prosenjit-itobuz,项目名称:upages,代码行数:40,代码来源:adrotate-export.php

示例11: saveXMLdocumentToFile

 function saveXMLdocumentToFile($books, $Page)
 {
     $xml = new SimpleXMLElement('<Books/>');
     foreach ($books as $key) {
         $book = $xml->addChild('book');
         $book->addChild('title', $key['title']);
         $book->addChild('author', $key['author']);
         $book->addChild('pages', $key['pages']);
         $book->addChild('language', $key['language']);
     }
     $xml->saveXML('data/books.xml');
     // write only 5 records to xml file depends on current page
     $xml = new SimpleXMLElement('<Books/>');
     $curPage = $Page - 1;
     for ($i = $curPage * 5; $i < $curPage * 5 + 5; $i++) {
         $book = $xml->addChild('book');
         $book->addChild('title', $books[$i]['title']);
         $book->addChild('author', $books[$i]['author']);
         $book->addChild('pages', $books[$i]['pages']);
         $book->addChild('language', $books[$i]['language']);
     }
     $xml->saveXML('data/pagebooks.xml');
 }
开发者ID:nakiden,项目名称:quicksilk,代码行数:23,代码来源:FileXMLHandler.php

示例12: prepareRequest

 /**
  * @see uspsQuery::prepareRequest()
  * @throws waException
  */
 protected function prepareRequest()
 {
     $services = $this->getServices();
     $type = uspsServices::getServiceType($services[0]['id']);
     if (!$this->plugin->zip) {
         throw new waException($this->plugin->_w("Cannot calculate shipping rate because origin (sender's) ZIP code is not defined in USPS module settings"));
     }
     switch ($type) {
         case uspsServices::TYPE_DOMESTIC:
             $this->api = 'RateV4';
             $xml = new SimpleXMLElement('<RateV4Request/>');
             $xml->addChild('Revision');
             break;
         case uspsServices::TYPE_INTERNATIONAL:
             $this->api = 'IntlRateV2';
             $xml = new SimpleXMLElement('<IntlRateV2Request/>');
             break;
         default:
             throw new waException($this->plugin->_w("Unknown type of service"));
     }
     $xml->addAttribute('USERID', $this->plugin->user_id);
     $xml->addAttribute('PASSWORD', '');
     foreach ($services as $service) {
         $package = $xml->addChild('Package');
         $package->addAttribute('ID', str_replace(' ', '_', $service['code']));
         switch ($type) {
             case 'Domestic':
                 $this->prepareDomesticPackage($package, $service);
                 break;
             case 'International':
                 $this->prepareInternationalPackage($package, $service);
                 break;
         }
     }
     return $xml->saveXML();
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:40,代码来源:uspsRatingsQuery.class.php

示例13: SimpleXMLElement

//Run a loop for each uiConf to get its filesync key, thus acquiring its confile
foreach ($kcwUiconfs as $kcwUiconf) {
    /* @var $kcwUiconf uiConf */
    $kcwUiconfFilesyncKey = $kcwUiconf->getSyncKey(uiConf::FILE_SYNC_UICONF_SUB_TYPE_DATA);
    $kcwConfile = kFileSyncUtils::file_get_contents($kcwUiconfFilesyncKey, false, false);
    if (!$kcwConfile) {
        continue;
    }
    $kcwConfileXML = new SimpleXMLElement($kcwConfile);
    $path = '//provider[@id="kaltura" or @name="kaltura"]';
    $nodesToRemove = $kcwConfileXML->xpath($path);
    if (!count($nodesToRemove)) {
        continue;
    }
    if ($kcwUiconf->getCreationMode() != uiConf::UI_CONF_CREATION_MODE_MANUAL) {
        //No point in this "for" loop if we can't save the UIConf.
        foreach ($nodesToRemove as $nodeToRemove) {
            $nodeToRemoveDom = dom_import_simplexml($nodeToRemove);
            $nodeToRemoveDom->parentNode->removeChild($nodeToRemoveDom);
        }
        $kcwConfile = $kcwConfileXML->saveXML();
        $kcwUiconf->setConfFile($kcwConfile);
        $kcwUiconf->save();
    } else {
        $confilePath = $kcwUiconf->getConfFilePath() . "\n";
        fwrite($flog, $confilePath);
    }
    //$kcw_uiconf_filesync_key = $kcw_uiconf->getSyncKey(uiConf::FILE_SYNC_UICONF_SUB_TYPE_DATA);
    //kFileSyncUtils::file_put_contents($kcw_uiconf_filesync_key, $kcw_confile , false);
}
fclose($flog);
开发者ID:DBezemer,项目名称:server,代码行数:31,代码来源:removeKalturaFromKCW.php

示例14: xmlSerialize

 /**
  * @param boolean $returnSXE
  * @param \SimpleXMLElement $sxe
  * @return string|\SimpleXMLElement
  */
 public function xmlSerialize($returnSXE = false, $sxe = null)
 {
     if (null === $sxe) {
         $sxe = new \SimpleXMLElement('<SearchModifierCode xmlns="http://hl7.org/fhir"></SearchModifierCode>');
     }
     $sxe->addAttribute('value', $this->value);
     if ($returnSXE) {
         return $sxe;
     }
     return $sxe->saveXML();
 }
开发者ID:dcarbone,项目名称:php-fhir-generated,代码行数:16,代码来源:FHIRSearchModifierCode.php

示例15: xmlSerialize


//.........这里部分代码省略.........
         $this->OperationOutcome->xmlSerialize(true, $sxe->addChild('OperationOutcome'));
     }
     if (null !== $this->Order) {
         $this->Order->xmlSerialize(true, $sxe->addChild('Order'));
     }
     if (null !== $this->OrderResponse) {
         $this->OrderResponse->xmlSerialize(true, $sxe->addChild('OrderResponse'));
     }
     if (null !== $this->Organization) {
         $this->Organization->xmlSerialize(true, $sxe->addChild('Organization'));
     }
     if (null !== $this->Patient) {
         $this->Patient->xmlSerialize(true, $sxe->addChild('Patient'));
     }
     if (null !== $this->PaymentNotice) {
         $this->PaymentNotice->xmlSerialize(true, $sxe->addChild('PaymentNotice'));
     }
     if (null !== $this->PaymentReconciliation) {
         $this->PaymentReconciliation->xmlSerialize(true, $sxe->addChild('PaymentReconciliation'));
     }
     if (null !== $this->Person) {
         $this->Person->xmlSerialize(true, $sxe->addChild('Person'));
     }
     if (null !== $this->Practitioner) {
         $this->Practitioner->xmlSerialize(true, $sxe->addChild('Practitioner'));
     }
     if (null !== $this->Procedure) {
         $this->Procedure->xmlSerialize(true, $sxe->addChild('Procedure'));
     }
     if (null !== $this->ProcedureRequest) {
         $this->ProcedureRequest->xmlSerialize(true, $sxe->addChild('ProcedureRequest'));
     }
     if (null !== $this->ProcessRequest) {
         $this->ProcessRequest->xmlSerialize(true, $sxe->addChild('ProcessRequest'));
     }
     if (null !== $this->ProcessResponse) {
         $this->ProcessResponse->xmlSerialize(true, $sxe->addChild('ProcessResponse'));
     }
     if (null !== $this->Provenance) {
         $this->Provenance->xmlSerialize(true, $sxe->addChild('Provenance'));
     }
     if (null !== $this->Questionnaire) {
         $this->Questionnaire->xmlSerialize(true, $sxe->addChild('Questionnaire'));
     }
     if (null !== $this->QuestionnaireResponse) {
         $this->QuestionnaireResponse->xmlSerialize(true, $sxe->addChild('QuestionnaireResponse'));
     }
     if (null !== $this->ReferralRequest) {
         $this->ReferralRequest->xmlSerialize(true, $sxe->addChild('ReferralRequest'));
     }
     if (null !== $this->RelatedPerson) {
         $this->RelatedPerson->xmlSerialize(true, $sxe->addChild('RelatedPerson'));
     }
     if (null !== $this->RiskAssessment) {
         $this->RiskAssessment->xmlSerialize(true, $sxe->addChild('RiskAssessment'));
     }
     if (null !== $this->Schedule) {
         $this->Schedule->xmlSerialize(true, $sxe->addChild('Schedule'));
     }
     if (null !== $this->SearchParameter) {
         $this->SearchParameter->xmlSerialize(true, $sxe->addChild('SearchParameter'));
     }
     if (null !== $this->Slot) {
         $this->Slot->xmlSerialize(true, $sxe->addChild('Slot'));
     }
     if (null !== $this->Specimen) {
         $this->Specimen->xmlSerialize(true, $sxe->addChild('Specimen'));
     }
     if (null !== $this->StructureDefinition) {
         $this->StructureDefinition->xmlSerialize(true, $sxe->addChild('StructureDefinition'));
     }
     if (null !== $this->Subscription) {
         $this->Subscription->xmlSerialize(true, $sxe->addChild('Subscription'));
     }
     if (null !== $this->Substance) {
         $this->Substance->xmlSerialize(true, $sxe->addChild('Substance'));
     }
     if (null !== $this->SupplyDelivery) {
         $this->SupplyDelivery->xmlSerialize(true, $sxe->addChild('SupplyDelivery'));
     }
     if (null !== $this->SupplyRequest) {
         $this->SupplyRequest->xmlSerialize(true, $sxe->addChild('SupplyRequest'));
     }
     if (null !== $this->TestScript) {
         $this->TestScript->xmlSerialize(true, $sxe->addChild('TestScript'));
     }
     if (null !== $this->ValueSet) {
         $this->ValueSet->xmlSerialize(true, $sxe->addChild('ValueSet'));
     }
     if (null !== $this->VisionPrescription) {
         $this->VisionPrescription->xmlSerialize(true, $sxe->addChild('VisionPrescription'));
     }
     if (null !== $this->Parameters) {
         $this->Parameters->xmlSerialize(true, $sxe->addChild('Parameters'));
     }
     if ($returnSXE) {
         return $sxe;
     }
     return $sxe->saveXML();
 }
开发者ID:dcarbone,项目名称:php-fhir-generated,代码行数:101,代码来源:FHIRResourceContainer.php


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