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


PHP XMLCustomWriter::createTextNode方法代码示例

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


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

示例1:

 function &createChildWithText(&$doc, &$node, $name, $value, $appendIfEmpty = true)
 {
     $childNode = null;
     if ($appendIfEmpty || $value != '') {
         $childNode =& XMLCustomWriter::createElement($doc, $name);
         $textNode =& XMLCustomWriter::createTextNode($doc, $value);
         XMLCustomWriter::appendChild($childNode, $textNode);
         XMLCustomWriter::appendChild($node, $childNode);
     }
     return $childNode;
 }
开发者ID:LiteratimBi,项目名称:jupitertfn,代码行数:11,代码来源:XMLCustomWriter.inc.php

示例2: explode

 /**
  * Create a new XML node.
  * @param $doc XMLNode|DOMImplementation
  * @param $nodePath string an XPath-like string that describes the
  *  node to be created.
  * @param $value string the value to be added as a text node (if any)
  * @return XMLNode|DOMDocument
  */
 function &_createNode($doc, $nodePath, $value = null)
 {
     // Separate the element name from the attributes.
     $elementPlusAttributes = explode('[', $nodePath);
     $element = $elementPlusAttributes[0];
     assert(!empty($element));
     // Create the element.
     $newNode =& XMLCustomWriter::createElement($doc, $element);
     // Add attributes.
     if (count($elementPlusAttributes) == 2) {
         // Separate the attribute key/value pairs.
         $unparsedAttributes = explode('@', rtrim(ltrim($elementPlusAttributes[1], '@'), ']'));
         foreach ($unparsedAttributes as $unparsedAttribute) {
             // Split attribute expressions into key and value.
             list($attributeName, $attributeValue) = explode('=', rtrim($unparsedAttribute, ' '));
             $attributeValue = trim($attributeValue, '"');
             XMLCustomWriter::setAttribute($newNode, $attributeName, $attributeValue);
         }
     }
     // Insert a text node if we got a value for it.
     if (!is_null($value)) {
         $textNode =& XMLCustomWriter::createTextNode($doc, $value);
         XMLCustomWriter::appendChild($newNode, $textNode);
     }
     return $newNode;
 }
开发者ID:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:34,代码来源:Mods34DescriptionXmlFilter.inc.php

示例3: foreach

 /**
  * Generate doi_data element - this is what assigns the DOI
  * @param $doc XMLNode
  * @param $DOI string
  * @param $url string
  * @param $galleys array
  */
 function &_generateDOIdataDom(&$doc, $DOI, $url, $galleys = null)
 {
     $request = Application::getRequest();
     $journal = $request->getJournal();
     $DOIdataNode =& XMLCustomWriter::createElement($doc, 'doi_data');
     XMLCustomWriter::createChildWithText($doc, $DOIdataNode, 'doi', $DOI);
     XMLCustomWriter::createChildWithText($doc, $DOIdataNode, 'resource', $url);
     /* article galleys */
     if ($galleys) {
         $collectionNode = XMLCustomWriter::createElement($doc, 'collection');
         XMLCustomWriter::setAttribute($collectionNode, 'property', 'text-mining');
         XMLCustomWriter::appendChild($DOIdataNode, $collectionNode);
         foreach ($galleys as $galley) {
             $itemNode = XMLCustomWriter::createElement($doc, 'item');
             XMLCustomWriter::appendChild($collectionNode, $itemNode);
             $resourceNode = XMLCustomWriter::createElement($doc, 'resource');
             XMLCustomWriter::appendChild($itemNode, $resourceNode);
             XMLCustomWriter::setAttribute($resourceNode, 'mime_type', $galley->getFileType());
             $urlNode = XMLCustomWriter::createTextNode($doc, $request->url(null, 'article', 'viewFile', array($galley->getArticleId(), $galley->getBestGalleyId($journal))));
             XMLCustomWriter::appendChild($resourceNode, $urlNode);
         }
     }
     return $DOIdataNode;
 }
开发者ID:ulsdevteam,项目名称:EzidDOI,代码行数:31,代码来源:EzidExportDom.inc.php

示例4: array

 /**
  * Create an XML element with a text node.
  *
  * FIXME: Move this to XMLCustomWriter? I leave the decision up to PKP...
  *
  * @param $name string
  * @param $value string
  * @param $attributes array An array with the attribute names as array
  *  keys and attribute values as array values.
  *
  * @return XMLNode|DOMImplementation
  */
 function &createElementWithText($name, $value, $attributes = array())
 {
     $element =& XMLCustomWriter::createElement($this->getDoc(), $name);
     $elementContent =& XMLCustomWriter::createTextNode($this->getDoc(), String::html2text($value));
     XMLCustomWriter::appendChild($element, $elementContent);
     foreach ($attributes as $attributeName => $attributeValue) {
         XMLCustomWriter::setAttribute($element, $attributeName, $attributeValue);
     }
     return $element;
 }
开发者ID:jalperin,项目名称:ojs,代码行数:22,代码来源:DOIExportDom.inc.php

示例5: explode

 /**
  * Create a new XML node.
  * @param $doc XMLNode|DOMImplementation
  * @param $nodePath string an XPath-like string that describes the
  *  node to be created.
  * @param $value string the value to be added as a text node (if any)
  * @return XMLNode|DOMDocument
  */
 function &_createNode($doc, $nodePath, $value = null)
 {
     // Separate the element name from the attributes.
     $elementPlusAttributes = explode('[', $nodePath);
     $element = $elementPlusAttributes[0];
     assert(!empty($element));
     // Create the element.
     $newNode =& XMLCustomWriter::createElement($doc, $element);
     // Check for configurable attributes in element value, remove them from value
     // and add them to regular attributes
     $attributeOffset = strpos($value, '[@');
     if ($attributeOffset !== false) {
         // no configurable attributes
         if (count($elementPlusAttributes) < 2) {
             $elementPlusAttributes[] = '';
         }
         if ($attributeOffset !== 0) {
             $elementPlusAttributes[1] = rtrim($elementPlusAttributes[1], ']') . ltrim(substr($value, $attributeOffset), '[');
             $value = substr($value, 0, $attributeOffset);
         } else {
             $elementPlusAttributes[1] = rtrim($elementPlusAttributes[1], ']') . ltrim(substr($value, $attributeOffset), '[');
             $value = "";
         }
     }
     // Add attributes.
     if (count($elementPlusAttributes) == 2) {
         // Separate the attribute key/value pairs.
         $unparsedAttributes = explode('@', rtrim(ltrim($elementPlusAttributes[1], '@'), ']'));
         foreach ($unparsedAttributes as $unparsedAttribute) {
             // Split attribute expressions into key and value.
             list($attributeName, $attributeValue) = explode('=', rtrim($unparsedAttribute, ' '));
             $attributeValue = trim($attributeValue, '"');
             XMLCustomWriter::setAttribute($newNode, $attributeName, $attributeValue);
         }
     }
     // Insert a text node if we got a value for it.
     if (!is_null($value)) {
         $textNode =& XMLCustomWriter::createTextNode($doc, $value);
         XMLCustomWriter::appendChild($newNode, $textNode);
     }
     return $newNode;
 }
开发者ID:kadowa,项目名称:omp-xepicur-metadata-plugin,代码行数:50,代码来源:Epc10DescriptionXmlFilter.inc.php


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