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


PHP DOMElement::appendChild方法代码示例

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


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

示例1: addGroup

 public function addGroup($title)
 {
     $element = $this->createElement('group');
     $this->db->appendChild($element);
     $element->setTitle($title);
     return $element;
 }
开发者ID:jepster,项目名称:yiipass,代码行数:7,代码来源:KeepassXDbDoc.php

示例2:

	function insert_node(DOMDocument &$doc, DOMElement &$field_elem, SimpleXMLElement $details_xml)
	{
		$travel_res_submitted_fields = dom_import_simplexml($details_xml->travel_res_submitted_fields[0]);
		//$travel_res_submitted_fields = $doc->createElement("travel_res_submitted_fields");
		$dom_sxe = $doc->importNode($travel_res_submitted_fields, true);
		$field_elem->appendChild($dom_sxe);

		if ($details_xml->travel_product[0])
		{
			$travel_res_product = dom_import_simplexml($details_xml->travel_product[0]);
			//$travel_res_submitted_fields = $doc->createElement("travel_res_submitted_fields");
			$dom_sxe = $doc->importNode($travel_res_product, true);
			$field_elem->appendChild($dom_sxe);
		}
		
		if ($details_xml->travel_lookups[0])
		{
			$travel_res_product_lookups = dom_import_simplexml($details_xml->travel_lookups[0]);
			//$travel_res_submitted_fields = $doc->createElement("travel_res_submitted_fields");
			$dom_sxe_lkp = $doc->importNode($travel_res_product_lookups, true);
			$field_elem->appendChild($dom_sxe_lkp);
		}
		
		
	}
开发者ID:awgtek,项目名称:myedb,代码行数:25,代码来源:TravelRequestInfoNode.php

示例3: insertDate

 /**
  * Inserts <meta:creation-date /> and <dc:date/> tags.
  *
  * Note that OpenOffice.org 3.1.1 is not capable of parsing W3C compliant 
  * dates with TZ offset correctly {@see
  * http://www.openoffice.org/issues/show_bug.cgi?id=107437}. We do not work 
  * around this issue, since it's too minor.
  * 
  * @param DOMElement $metaSection 
  */
 protected function insertDate(DOMElement $metaSection)
 {
     $date = new DateTime();
     $dateString = $date->format(DateTime::W3C);
     $metaSection->appendChild($metaSection->ownerDocument->createElementNS(ezcDocumentOdt::NS_ODT_META, 'meta:creation-date', $dateString));
     $metaSection->appendChild($metaSection->ownerDocument->createElementNS(ezcDocumentOdt::NS_DC, 'dc:date', $dateString));
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:17,代码来源:meta_generator.php

示例4: serialize

 /**
  * serialize 
  * 
  * @param DOMElement $prop 
  * @return void
  */
 public function serialize(Sabre_DAV_Server $server, DOMElement $prop)
 {
     $doc = $prop->ownerDocument;
     if (!$this->supportsLocks) {
         return null;
     }
     $lockEntry1 = $doc->createElementNS('DAV:', 'd:lockentry');
     $lockEntry2 = $doc->createElementNS('DAV:', 'd:lockentry');
     $prop->appendChild($lockEntry1);
     $prop->appendChild($lockEntry2);
     $lockScope1 = $doc->createElementNS('DAV:', 'd:lockscope');
     $lockScope2 = $doc->createElementNS('DAV:', 'd:lockscope');
     $lockType1 = $doc->createElementNS('DAV:', 'd:locktype');
     $lockType2 = $doc->createElementNS('DAV:', 'd:locktype');
     $lockEntry1->appendChild($lockScope1);
     $lockEntry1->appendChild($lockType1);
     $lockEntry2->appendChild($lockScope2);
     $lockEntry2->appendChild($lockType2);
     $lockScope1->appendChild($doc->createElementNS('DAV:', 'd:exclusive'));
     $lockScope2->appendChild($doc->createElementNS('DAV:', 'd:shared'));
     $lockType1->appendChild($doc->createElementNS('DAV:', 'd:write'));
     $lockType2->appendChild($doc->createElementNS('DAV:', 'd:write'));
     //$frag->appendXML('<d:lockentry><d:lockscope><d:exclusive /></d:lockscope><d:locktype><d:write /></d:locktype></d:lockentry>');
     //$frag->appendXML('<d:lockentry><d:lockscope><d:shared /></d:lockscope><d:locktype><d:write /></d:locktype></d:lockentry>');
 }
开发者ID:Sywooch,项目名称:forums,代码行数:31,代码来源:SupportedLock.php

示例5: __get

 /**
  * Appends child node
  *
  * @param $tag
  * @return XmlBuilder
  */
 public function __get($tag)
 {
     $node = $this->__dom__->createElement($tag);
     $this->__currentNode__->appendChild($node);
     $this->__currentNode__ = $node;
     return $this;
 }
开发者ID:lenninsanchez,项目名称:donadores,代码行数:13,代码来源:XmlBuilder.php

示例6: convert_to_xml

 /**
  * This function converts an associated array to an XML string.
  *
  * @access protected
  * @static
  * @param array $array                          the associated array to be converted
  * @param DOMElement $domElement                the XML DOM element
  * @param DOMDocument $document                 the XML DOM document
  * @return string                               a string formatted with XML
  *
  * @see http://darklaunch.com/2009/05/23/php-xml-encode-using-domdocument-convert-array-to-xml-json-encode
  */
 protected static function convert_to_xml($array, $domElement = NULL, $document = NULL)
 {
     if ($document === NULL) {
         $document = new DOMDocument();
         $document->formatOutput = TRUE;
         static::convert_to_xml($array, $document, $document);
         return $document->asXML();
     } else {
         if (is_array($array)) {
             foreach ($array as $node => $value) {
                 $element = NULL;
                 if (is_integer($node)) {
                     $element = $domElement;
                 } else {
                     $element = $document->createElement($node);
                     $domElement->appendChild($element);
                 }
                 static::convert_to_xml($value, $element, $document);
             }
         } else {
             if (is_string($array) and preg_match('/^<!CDATA\\[.*\\]\\]>$/', $array)) {
                 $array = substr($array, 8, strlen($array) - 11);
                 $element = $document->createCDATASection($array);
                 $domElement->appendChild($element);
             } else {
                 $element = $document->createTextNode($array);
                 $domElement->appendChild($element);
             }
         }
     }
 }
开发者ID:ruslankus,项目名称:invoice-crm,代码行数:43,代码来源:XML.php

示例7: createRequest

 /**
  * Build the document structures based on parameters and arguments. This method
  * is also called if you convert ths class instance to string
  */
 public function createRequest()
 {
     if ($this->__documentReady === true) {
         return true;
     }
     foreach ($this->__argumentData as $aName => $aValue) {
         $argument = $this->createElement('argument');
         $argument->setAttribute('name', $aName);
         $argument->appendChild($this->createCDATASection($aValue));
         $this->__rootNode->appendChild($argument);
     }
     $resourceDescriptor = $this->createElement('resourceDescriptor');
     foreach ($this->__resourceDescriptors as $rName => $rValue) {
         $resourceDescriptor->setAttribute($rName, $rValue);
     }
     $label = $this->createElement('label', $this->__label == null ? 'null' : $this->__label);
     $resourceDescriptor->appendChild($label);
     foreach ($this->__parameterData as $pName => $pValue) {
         $parameter = $this->createElement('parameter');
         $parameter->setAttribute('name', $pName);
         $parameter->appendChild($this->createCDATASection($pValue));
         $resourceDescriptor->appendChild($parameter);
     }
     $this->__rootNode->appendChild($resourceDescriptor);
     return $this->__documentReady = true;
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:30,代码来源:JasperRequestXmlDoc.class.php

示例8: array2domAttr

 /**
  * Add dom attributes from array
  * @static
  * @param \DOMElement|\DOMNode $node
  * @param array $array
  * @param bool $verbal
  */
 public static function array2domAttr(&$node, $array, $verbal = false)
 {
     if (is_array($array) and !empty($array)) {
         foreach ($array as $k => $v) {
             if (is_numeric($k) and !is_array($v) and !is_object($v) and ctype_alnum($v)) {
                 $node->appendChild($node->ownerDocument->createElement(ctype_alpha($v[0]) ? $v : "_{$v}"));
             } elseif (is_array($v)) {
                 if (is_numeric($k)) {
                     $k = "_{$k}";
                 }
                 $newNode = $node->appendChild($node->ownerDocument->createElement($k));
                 self::array2domAttr($newNode, $v, $verbal);
             } elseif (is_object($v)) {
             } else {
                 if ($verbal) {
                     if (is_null($v)) {
                         $v = 'null';
                     } elseif ($v === false) {
                         $v = 'false';
                     } elseif ($v === true) {
                         $v = 'true';
                     } elseif ($v === 0) {
                         $v = '0';
                     }
                 }
                 $node->setAttribute(ctype_alpha($k[0]) ? $k : "_{$k}", $v);
             }
         }
     }
 }
开发者ID:difra-org,项目名称:difra,代码行数:37,代码来源:DOM.php

示例9: addElement

 private function addElement(EntryModel $entry, $changeFrequency, $priority)
 {
     //Check if manually hidden
     if ($entry->SiteMapPluginHideFromSiteMap) {
         return;
     }
     //Check if entry has URL, some sections don't
     if (!$entry->getUrl()) {
         return;
     }
     $url = $this->dom->createElement('url');
     $urlLoc = $this->dom->createElement('loc');
     $urlLoc->nodeValue = $entry->getUrl();
     $url->appendChild($urlLoc);
     $urlModified = $this->dom->createElement('lastmod');
     $urlModified->nodeValue = $entry->postDate->w3c();
     $url->appendChild($urlModified);
     $urlChangeFreq = $this->dom->createElement('changefreq');
     $urlChangeFreq->nodeValue = $changeFrequency;
     $url->appendChild($urlChangeFreq);
     $urlPriority = $this->dom->createElement('priority');
     $urlPriority->nodeValue = $priority;
     $url->appendChild($urlPriority);
     $this->urlset->appendChild($url);
 }
开发者ID:webremote,项目名称:Sitemap-Craft-Plugin,代码行数:25,代码来源:Sitemap_RenderController.php

示例10: addHeaderElement

 /**
  * Add new soap header.
  *
  * @param \DOMElement $node           DOMElement to add
  * @param boolean     $mustUnderstand SOAP header mustUnderstand attribute
  * @param string      $actor          SOAP actor/role
  * @param string      $soapVersion    SOAP version SOAP_1_1|SOAP_1_2
  *
  * @return void
  */
 public function addHeaderElement(\DOMElement $node, $mustUnderstand = null, $actor = null, $soapVersion = SOAP_1_1)
 {
     $root = $this->domDocument->documentElement;
     $namespace = $root->namespaceURI;
     $prefix = $root->prefix;
     if (null !== $mustUnderstand) {
         $node->appendChild(new \DOMAttr($prefix . ':mustUnderstand', (int) $mustUnderstand));
     }
     if (null !== $actor) {
         $attributeName = $soapVersion == SOAP_1_1 ? 'actor' : 'role';
         $node->appendChild(new \DOMAttr($prefix . ':' . $attributeName, $actor));
     }
     $nodeListHeader = $root->getElementsByTagNameNS($namespace, 'Header');
     // add header if not there
     if ($nodeListHeader->length == 0) {
         // new header element
         $header = $this->domDocument->createElementNS($namespace, $prefix . ':Header');
         // try to add it before body
         $nodeListBody = $root->getElementsByTagNameNS($namespace, 'Body');
         if ($nodeListBody->length == 0) {
             $root->appendChild($header);
         } else {
             $body = $nodeListBody->item(0);
             $header = $body->parentNode->insertBefore($header, $body);
         }
         $header->appendChild($node);
     } else {
         $nodeListHeader->item(0)->appendChild($node);
     }
 }
开发者ID:mablae,项目名称:BeSimpleSoap,代码行数:40,代码来源:FilterHelper.php

示例11: setMessageElements

 /**
  * Sets the message elements for this operation into the wsdl document
  * @param 	DOMElement 		$wsdl		The parent domelement for the messages
  * @param 	DomDocument		$dom		The dom document to create the messages as children of
  */
 public function setMessageElements(DOMElement $wsdl, DOMDocument $dom)
 {
     $input = $this->inputMessage->getMessageElement($dom);
     $output = $this->outputMessage->getMessageElement($dom);
     $wsdl->appendChild($input);
     $wsdl->appendChild($output);
 }
开发者ID:Nurudeen,项目名称:prado,代码行数:12,代码来源:WsdlOperation.php

示例12: getHTMLNodeInner

 /**
  * Get the html node for this element
  *
  * @param \DOMElement $node
  * @param \AppShed\Remote\XML\DOMDocument $xml
  * @param \AppShed\Remote\HTML\Settings $settings
  */
 protected function getHTMLNodeInner($node, $xml, $settings)
 {
     if (!empty($this->title)) {
         $node->appendChild($xml->createElement('div', ['class' => 'title', 'text' => $this->title]));
     }
     $node->appendChild($inner = $xml->createElement('div', 'textbox-container' . (empty($this->title) ? ' no-title' : '')));
     $inner->appendChild($xml->createElement('span', ['class' => 'picked', 'data-value' => $this->value ? $this->type == static::TYPE_DATE ? $this->value->getTimestamp() : $this->value->format('H:i') : null, 'data-placeholder' => $this->placeHolder, 'data-variable' => $this->variableName, 'data-picker-type' => $this->type, 'data-save-value' => $this->save]));
 }
开发者ID:appshed,项目名称:extension-api,代码行数:15,代码来源:Picker.php

示例13: add

 /**
  * @param Sitemap_URL $object 
  */
 public function add(Sitemap_URL $object)
 {
     $url = $object->create();
     // Decorate the urlset
     $object->root($this->_root);
     // Append URL to root element
     $this->_root->appendChild($this->_xml->importNode($url, TRUE));
 }
开发者ID:Alexander711,项目名称:naav1,代码行数:11,代码来源:sitemap.php

示例14: getHTMLNodeInner

 /**
  * Get the html node for this element
  *
  * @param \DOMElement $node
  * @param \AppShed\Remote\XML\DOMDocument $xml
  * @param \AppShed\Remote\HTML\Settings $settings
  */
 protected function getHTMLNodeInner($node, $xml, $settings)
 {
     if ($this->image) {
         $node->appendChild($xml->createImgElement($this->image->getUrl(), 'icon', $this->image->getSize()));
     }
     $node->appendChild($xml->createElement('div', ['class' => 'text', 'text' => $this->title]));
     $this->applyLinkToNode($xml, $node, $settings);
 }
开发者ID:appshed,项目名称:extension-api,代码行数:15,代码来源:Link.php

示例15: getHTMLNodeInner

 /**
  * Get the html node for this element
  *
  * @param \DOMElement $node
  * @param \AppShed\Remote\XML\DOMDocument $xml
  * @param \AppShed\Remote\HTML\Settings $settings
  */
 protected function getHTMLNodeInner($node, $xml, $settings)
 {
     if (!empty($this->title)) {
         $node->appendChild($xml->createElement('div', ['class' => 'title', 'text' => $this->title]));
     }
     $node->appendChild($inner = $xml->createElement('div', 'textarea-container' . (empty($this->title) ? ' no-title' : '')));
     $inner->appendChild($xml->createElement('textarea', ['class' => 'textarea', 'name' => $this->variableName, 'text' => $this->value, 'data-variable' => $this->variableName, 'data-save-value' => $this->save]));
 }
开发者ID:appshed,项目名称:extension-api,代码行数:15,代码来源:TextArea.php


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