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


PHP DOMNode::C14N方法代码示例

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


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

示例1: _getComparableXmlString

 private function _getComparableXmlString(\DOMNode $node)
 {
     if ($node instanceof \DOMDocument) {
         return $node->C14N();
     }
     $dom = new \DOMDocument();
     $dom->appendChild($dom->importNode($node, true));
     return $dom->C14N();
 }
开发者ID:belanur,项目名称:mokka,代码行数:9,代码来源:DomNodeComparator.php

示例2: getChildrenAsString

 /**
  * @return string
  */
 public function getChildrenAsString()
 {
     return $this->node->C14N();
 }
开发者ID:RavenB,项目名称:html-to-markdown,代码行数:7,代码来源:Element.php

示例3: nodeToText

 /**
  * Returns the normalized, whitespace-cleaned, and indented textual
  * representation of a DOMNode.
  *
  * @param  DOMNode $node
  * @param  boolean $canonicalize
  * @param  boolean $ignoreCase
  * @return string
  */
 private function nodeToText(DOMNode $node, $canonicalize, $ignoreCase)
 {
     if ($canonicalize) {
         $document = new DOMDocument();
         $document->loadXML($node->C14N());
         $node = $document;
     }
     if ($node instanceof DOMDocument) {
         $document = $node;
     } else {
         $document = $node->ownerDocument;
     }
     $document->formatOutput = true;
     $document->normalizeDocument();
     if ($node instanceof DOMDocument) {
         $text = $node->saveXML();
     } else {
         $text = $document->saveXML($node);
     }
     if ($ignoreCase) {
         $text = strtolower($text);
     }
     return $text;
 }
开发者ID:jmilagroso,项目名称:rijndael256encryptdecrypt,代码行数:33,代码来源:DOMNode.php

示例4: getXML

 public function getXML()
 {
     return $this->retInutNFe->C14N();
 }
开发者ID:phpnfe,项目名称:nfe,代码行数:4,代码来源:InutilizacaoRetorno.php

示例5: cout

 /**
  * Pretty print XML tree.
  *
  * @param   \DOMNode  $element    Element.
  * @return  string
  */
 public function cout(\DOMNode $element)
 {
     if (1 === $this->_color) {
         return $element->C14N();
     }
     $out = null;
     $nodes = $element->childNodes;
     for ($i = 0, $max = $nodes->length; $i < $max; ++$i) {
         $node = $nodes->item($i);
         switch ($node->nodeType) {
             case XML_ELEMENT_NODE:
                 $out .= $this->color('<', 'oc') . $this->color($node->tagName, 'tagname');
                 foreach ($node->attributes as $attr) {
                     $out .= ' ' . $this->color($attr->name, 'attrname') . $this->color('=', '=') . $this->color('"', 'q') . $this->color($attr->value, 'attrvalue') . $this->color('"', 'q');
                 }
                 $out .= $this->color('>', 'oc') . $this->cout($node) . $this->color('</', 'oc') . $this->color($node->tagName, 'tagname') . $this->color('>', 'oc');
                 break;
             case XML_TEXT_NODE:
                 $out .= $this->color($node->wholeText, 'text');
                 break;
             case XML_CDATA_SECTION_NODE:
                 break;
             case XML_ENTITY_REF_NODE:
                 $out .= $this->color('&' . $node->name . ';', 'entity');
                 break;
             case XML_ENTITY_NODE:
                 break;
             case XML_PI_NODE:
                 $out .= $this->color('<?' . $node->target . ' ' . $node->data . '?>', 'pi');
                 break;
             case XML_COMMENT_NODE:
                 $out .= $this->color('<!--' . $node->data . '-->', 'comment');
                 break;
             default:
                 var_dump($node->nodeType);
         }
     }
     return $out;
 }
开发者ID:Grummfy,项目名称:Central,代码行数:45,代码来源:Shell.php

示例6: canonicalize

 /**
  * Canonicalizes a DOM document or a single DOM node
  * 
  * @param	\DOMNode					$data	Node(s) to be canonicalized
  * @throws	\UnexpectedValueException			If the canonicalization process failed
  * @return	string|bool							Canonicalized node(s), or false on failure
  */
 protected function canonicalize(\DOMNode $object)
 {
     $options = $this->c14nOptionMapping[$this->canonicalMethod];
     // canonicalize the provided data with the preset options
     $c14nData = $object->C14N($options['exclusive'], $options['withComments']);
     if (is_string($c14nData) && strlen($c14nData)) {
         return $c14nData;
     }
     throw new \UnexpectedValueException('Unable to canonicalize the provided DOM document');
 }
开发者ID:calebprior,项目名称:php-XmlDigitalSignature,代码行数:17,代码来源:XmlDigitalSignature.php

示例7: convert_code

 /**
  * Convert Code
  *
  * Convert code tags by indenting blocks of code and wrapping single lines in backticks.
  *
  * @param DOMNode $node
  * @return string
  */
 private function convert_code($node)
 {
     // Store the content of the code block in an array, one entry for each line
     $markdown = '';
     $code_content = html_entity_decode($node->C14N());
     $code_content = str_replace(array("<code>", "</code>"), "", $code_content);
     $code_content = str_replace(array("<pre>", "</pre>"), "", $code_content);
     $lines = preg_split('/\\r\\n|\\r|\\n/', $code_content);
     $total = count($lines);
     // If there's more than one line of code, prepend each line with four spaces and no backticks.
     if ($total > 1 || $node->nodeName === 'pre') {
         // Remove the first and last line if they're empty
         $first_line = trim($lines[0]);
         $last_line = trim($lines[$total - 1]);
         $first_line = trim($first_line, "&#xD;");
         //trim XML style carriage returns too
         $last_line = trim($last_line, "&#xD;");
         if (empty($first_line)) {
             array_shift($lines);
         }
         if (empty($last_line)) {
             array_pop($lines);
         }
         $count = 1;
         foreach ($lines as $line) {
             $line = str_replace('&#xD;', '', $line);
             $markdown .= "    " . $line;
             // Add newlines, except final line of the code
             if ($count != $total) {
                 $markdown .= PHP_EOL;
             }
             $count++;
         }
         $markdown .= PHP_EOL;
     } else {
         // There's only one line of code. It's a code span, not a block. Just wrap it with backticks.
         $markdown .= "`" . $lines[0] . "`";
     }
     return $markdown;
 }
开发者ID:LastResortGames,项目名称:ludumdare,代码行数:48,代码来源:HTML_To_Markdown.php

示例8: canonicalize

 /**
  * Canonicalizes XML node.
  *
  * @see Sisyphus_C14n_C14nInterface::canonicalize()
  * Sisyphus_C14n_C14nInterface::canonicalize()
  *
  * @link http://php.net/manual/en/domnode.c14n.php DOMNode::C14N()
  *
  * @param DOMNode $xml DOM node to canonicalize
  *
  * @return string canonicalized XML as string
  */
 public function canonicalize(DOMNode $xml)
 {
     $inclusiveNamespaces = $this->getContext()->isExclusive() ? $this->getContext()->getInclusiveNamespaces() : null;
     return $xml->C14N($this->getContext()->isExclusive(), $this->getContext()->isWithComments(), $this->prepareXpathData(), $inclusiveNamespaces);
 }
开发者ID:bkon,项目名称:sisyphus,代码行数:17,代码来源:Libxml.php

示例9: getInner

 /**
  * Get the inner content of a DOMNode.
  *
  * @param \DOMNode $node A DOMNode instance
  *
  * @return string The inner content
  */
 protected function getInner(\DOMNode $node)
 {
     $c14n = $node->C14N();
     $begin = strpos($c14n, '>');
     $end = strrpos($c14n, '<');
     $content = substr($c14n, $begin + 1, $end - $begin - 1);
     return $content;
 }
开发者ID:alexandresalome,项目名称:php-selenium,代码行数:15,代码来源:XmlLoader.php


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