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


PHP DOMElement::hasAttributeNS方法代码示例

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


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

示例1: __construct

 /**
  * Create a PAOS Request element.
  *
  * @param DOMElement|NULL $xml  The XML element we should load.
  */
 public function __construct(DOMElement $xml = NULL)
 {
     if ($xml === NULL) {
         return;
     }
     if (!$xml->hasAttributeNS(SAML2_Const::NS_SOAP, 'mustUnderstand')) {
         throw new Exception('Missing soap-env:mustUnderstand attribute in <paos:Request>.');
     } elseif ($xml->getAttributeNS(SAML2_Const::NS_SOAP, 'mustUnderstand') !== '1') {
         throw new Exception('Invalid value of soap-env:mustUnderstand attribute in <paos:Request>.');
     }
     if (!$xml->hasAttributeNS(SAML2_Const::NS_SOAP, 'actor')) {
         throw new Exception('Missing soap-env:mustUnderstand attribute in <paos:Request>.');
     } elseif ($xml->getAttributeNS(SAML2_Const::NS_SOAP, 'actor') !== 'http://schemas.xmlsoap.org/soap/actor/next') {
         throw new Exception('Invalid value of soap-env:actor attribute in <paos:Request>.');
     }
     if (!$xml->hasAttribute('responseConsumerURL')) {
         throw new Exception('Missing responseConsumerURL attribute in <paos:Request>.');
     }
     $this->responseConsumerURL = $xml->getAttribute('responseConsumerURL');
     if (!$xml->hasAttribute('service')) {
         throw new Exception('Missing service attribute in <paos:Request>.');
     }
     $this->service = $xml->getAttribute('service');
     if ($xml->hasAttribute('messageID')) {
         $this->messageID = $xml->getAttribute('messageID');
     }
 }
开发者ID:sitya,项目名称:saml2,代码行数:32,代码来源:Request.php

示例2: checkXML

 /**
  * Basic check of the given XML, it is not part of __construct in order to reduce NPath Complexity
  *
  * @param DOMElement|NULL $xml  The XML element we should check before loading.
  */
 public function checkXML(DOMElement $xml)
 {
     if (!$xml->hasAttributeNS(SAML2_Const::NS_SOAP, 'mustUnderstand')) {
         return 'Missing soap-env:mustUnderstand attribute in <ecp:Request>.';
     } elseif ($xml->getAttributeNS(SAML2_Const::NS_SOAP, 'mustUnderstand') !== '1') {
         return 'Invalid value of soap-env:mustUnderstand attribute in <ecp:Request>.';
     }
     if (!$xml->hasAttributeNS(SAML2_Const::NS_SOAP, 'actor')) {
         return 'Missing soap-env:mustUnderstand attribute in <ecp:Request>.';
     } elseif ($xml->getAttributeNS(SAML2_Const::NS_SOAP, 'actor') !== 'http://schemas.xmlsoap.org/soap/actor/next') {
         return 'Invalid value of soap-env:actor attribute in <ecp:Request>.';
     }
     return TRUE;
 }
开发者ID:sitya,项目名称:saml2,代码行数:19,代码来源:Request.php

示例3: parseStyles

 /**
  * @param DOMElement $element
  * @param array $style
  * @return array
  */
 function parseStyles(DOMElement $element, $style = array())
 {
     if ($element->hasAttributeNS($this->ttsNS, 'fontWeight') && $element->getAttributeNS($this->ttsNS, 'fontWeight') == 'bold') {
         $style['bold'] = true;
     }
     if ($element->hasAttributeNS($this->ttsNS, 'fontStyle') && $element->getAttributeNS($this->ttsNS, 'fontStyle') == 'italic') {
         $style['italic'] = true;
     }
     $copiedAtts = array('textAlign', 'displayAlign', 'color', 'backgroundColor', 'fontFamily', 'fontSize');
     foreach ($copiedAtts as $copiedAtt) {
         if ($element->hasAttributeNS($this->ttsNS, $copiedAtt)) {
             $style[$copiedAtt] = $element->getAttributeNS($this->ttsNS, $copiedAtt);
         }
     }
     return $style;
 }
开发者ID:DBezemer,项目名称:server,代码行数:21,代码来源:dfxpCaptionsContentManager.php

示例4: __construct

 /**
  * Create a ECP RelayState element.
  *
  * @param DOMElement|NULL $xml  The XML element we should load.
  */
 public function __construct(DOMElement $xml = NULL)
 {
     if ($xml === NULL) {
         return;
     }
     if (!$xml->hasAttributeNS(SAML2_Const::NS_SOAP, 'mustUnderstand')) {
         throw new Exception('Missing soap-env:mustUnderstand attribute in <ecp:RelayState>.');
     } elseif ($xml->getAttributeNS(SAML2_Const::NS_SOAP, 'mustUnderstand') !== '1') {
         throw new Exception('Invalid value of soap-env:mustUnderstand attribute in <ecp:RelayState>.');
     }
     if (!$xml->hasAttributeNS(SAML2_Const::NS_SOAP, 'actor')) {
         throw new Exception('Missing soap-env:mustUnderstand attribute in <ecp:RelayState>.');
     } elseif ($xml->getAttributeNS(SAML2_Const::NS_SOAP, 'actor') !== 'http://schemas.xmlsoap.org/soap/actor/next') {
         throw new Exception('Invalid value of soap-env:actor attribute in <ecp:RelayState>.');
     }
     $this->RelayState = $xml->textContent;
 }
开发者ID:sitya,项目名称:saml2,代码行数:22,代码来源:RelayState.php

示例5: offsetExists

 /**
  * Required by the ArrayAccess interface.
  *
  * @param  string $offset
  * @return boolean
  */
 public function offsetExists($offset)
 {
     if (strpos($offset, ':') !== false) {
         list($ns, $attr) = explode(':', $offset, 2);
         return $this->_element->hasAttributeNS(Zend_Feed::lookupNamespace($ns), $attr);
     } else {
         return $this->_element->hasAttribute($offset);
     }
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:15,代码来源:Element.php

示例6: hasAttribute

 /**
  * Validate if an attribute exists
  *
  * @param string $name
  * @return bool
  */
 public function hasAttribute($name)
 {
     list($namespace, $localName) = $this->resolveTagName($name);
     if ($namespace != '') {
         return parent::hasAttributeNS($namespace, $localName);
     } else {
         return parent::hasAttribute($name);
     }
 }
开发者ID:fluentdom,项目名称:fluentdom,代码行数:15,代码来源:Element.php

示例7: isElementValueNull

 private function isElementValueNull(\DOMElement $element)
 {
     $namespaceUri = 'http://www.w3.org/2001/XMLSchema-instance';
     if (!$element->hasAttributeNS($namespaceUri, 'nil')) {
         return false;
     }
     return 'true' === $element->getAttributeNS($namespaceUri, 'nil') || '1' === $element->getAttributeNS($namespaceUri, 'nil');
 }
开发者ID:khangaikh,项目名称:golocal,代码行数:8,代码来源:XmlFileLoader.php

示例8: getChildAttribute

 public function getChildAttribute(\DOMElement $node)
 {
     $name = $node->getAttributeNS($this->namespaces['sv'], 'name');
     $type = strtolower($node->getAttributeNS($this->namespaces['sv'], 'type'));
     $values = array();
     if ($name == 'jcr:created') {
         $values[] = date(self::DATEFORMAT);
     } else {
         foreach ($node->getElementsByTagNameNS($this->namespaces['sv'], 'value') as $nodeValue) {
             $values[] = $nodeValue->nodeValue;
         }
     }
     $isMultiValue = false;
     if ($name == 'jcr:mixinTypes' || count($values) > 1 || $node->hasAttributeNS($this->namespaces['sv'], 'multiple') && $node->getAttributeNS($this->namespaces['sv'], 'multiple') == 'true') {
         $isMultiValue = true;
     }
     return array($name, array('type' => $type, 'value' => $values, 'multiValued' => $isMultiValue));
 }
开发者ID:jackalope,项目名称:jackalope-prismic,代码行数:18,代码来源:DBUnitFixtureXML.php

示例9: getType

 /**
  * @param \DOMElement $node
  * @return string
  */
 private function getType(\DOMElement $node)
 {
     if ($node->hasAttributeNS(self::XMLNS_JSONDOM, 'type')) {
         return $node->getAttributeNS(self::XMLNS_JSONDOM, 'type');
     } else {
         $xpath = new Xpath($node->ownerDocument);
         return $xpath('count(*) > 0', $node) ? 'object' : 'string';
     }
 }
开发者ID:fluentdom,项目名称:fluentdom,代码行数:13,代码来源:JSONx.php

示例10: parseTextInput

 /**
  * Parses the provided XML element object and stores it as a feed textinput in
  * the provided ezcFeed object.
  *
  * @param ezcFeed $feed The feed object in which to store the parsed XML element as a feed textinput
  * @param DOMElement $xml The XML element object to parse
  */
 private function parseTextInput(ezcFeed $feed, DOMElement $xml = null)
 {
     $textInput = $feed->add('textInput');
     if ($xml !== null) {
         foreach ($xml->childNodes as $itemChild) {
             if ($itemChild->nodeType == XML_ELEMENT_NODE) {
                 $tagName = $itemChild->tagName;
                 switch ($tagName) {
                     case 'title':
                     case 'description':
                     case 'name':
                     case 'link':
                         $textInput->{$tagName} = $itemChild->textContent;
                         break;
                 }
             }
         }
         if ($xml->hasAttributeNS(self::NAMESPACE_URI, 'about')) {
             $textInput->about = $xml->getAttributeNS(self::NAMESPACE_URI, 'about');
         }
     }
 }
开发者ID:mdb-webdev,项目名称:livehelperchat,代码行数:29,代码来源:rss1.php

示例11: get_attr_value

 /**
  * Get a attribute value
  *
  * @param DOMElement $nod
  * @param string $name
  * @param string $ns
  * @return string
  */
 public function get_attr_value(&$nod, $name, $ns = null)
 {
     return is_null($ns) ? $nod->hasAttribute($name) ? $nod->getAttribute($name) : null : ($nod->hasAttributeNS($ns, $name) ? $nod->getAttributeNS($ns, $name) : null);
 }
开发者ID:rolandovanegas,项目名称:moodle,代码行数:12,代码来源:cc_resources.php

示例12: getListStyleName

 /**
  * Returns the list style name of the given $odtElement.
  *
  * Recursively searches for the style name of the given list element. The 
  * style name is only present at the top most list (for nested lists).
  * 
  * @param DOMElement $odtElement 
  * @return string
  */
 protected function getListStyleName(DOMElement $odtElement)
 {
     if ($odtElement->namespaceURI === ezcDocumentOdt::NS_ODT_TEXT && $odtElement->localName === 'list' && $odtElement->hasAttributeNS(ezcDocumentOdt::NS_ODT_TEXT, 'style-name')) {
         return $odtElement->getAttributeNS(ezcDocumentOdt::NS_ODT_TEXT, 'style-name');
     }
     if ($odtElement->parentNode === null) {
         throw new RuntimeException('No list style name found.');
     }
     return $this->getListStyleName($odtElement->parentNode);
 }
开发者ID:axelmdev,项目名称:ecommerce,代码行数:19,代码来源:inferencer.php

示例13: parseListLevel

 /**
  * Parses a list level style.
  *
  * Parses the given $listLevelElement and returns a corresponding 
  * list-level style object.
  * 
  * @param DOMElement $listLevelElement 
  * @return ezcDocumentOdtListLevelStyle
  */
 protected function parseListLevel(DOMElement $listLevelElement)
 {
     if (!isset(self::$listClassMap[$listLevelElement->localName])) {
         throw new RuntimeException("Unknown list-level element {$listLevelElement->localName}.");
     }
     $listLevelClass = self::$listClassMap[$listLevelElement->localName];
     $listLevel = new $listLevelClass($listLevelElement->getAttributeNS(ezcDocumentOdt::NS_ODT_TEXT, 'level'));
     foreach (self::$listAttributeMap[$listLevelElement->localName] as $ns => $attrs) {
         foreach ($attrs as $xmlAttr => $objAttr) {
             if ($listLevelElement->hasAttributeNS($ns, $xmlAttr)) {
                 $listLevel->{$objAttr} = $listLevelElement->getAttributeNS($ns, $xmlAttr);
             }
         }
     }
     return $listLevel;
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:25,代码来源:parser.php

示例14: getName

 /**
  * @param \DOMElement $node
  * @return string
  */
 private function getName(\DOMElement $node)
 {
     if ($node->hasAttributeNS(self::XMLNS_JSONDOM, 'name')) {
         return $node->getAttributeNS(self::XMLNS_JSONDOM, 'name');
     } else {
         return $node->localName;
     }
 }
开发者ID:fluentdom,项目名称:fluentdom,代码行数:12,代码来源:Json.php

示例15: parseScriptTask

 protected function parseScriptTask($id, \DOMElement $el, BusinessProcessBuilder $builder)
 {
     if ($el->hasAttributeNS(self::NS_IMPL, 'resource')) {
         $scriptTask = $builder->scriptResourceTask($id, $el->getAttributeNS(self::NS_IMPL, 'resource'), $el->getAttribute('name'));
     } else {
         $script = '';
         foreach ($this->xpath->query('m:script', $el) as $scriptElement) {
             $script .= $scriptElement->textContent;
         }
         $scriptTask = $builder->scriptTask($id, $el->getAttribute('scriptFormat'), $script, $el->getAttribute('name'));
     }
     $scriptTask->setDocumentation($builder->stringExp($this->getDocumentation($el)));
     $scriptTask->setAsyncBefore($this->getAsyncBefore($el));
     $scriptTask->setAsyncAfter($this->getAsyncAfter($el));
     if ($el->hasAttributeNS(self::NS_IMPL, 'resultVariable')) {
         $scriptTask->setResultVariable($el->getAttributeNS(self::NS_IMPL, 'resultVariable'));
     }
     return $scriptTask;
 }
开发者ID:Lesspion,项目名称:bpmn,代码行数:19,代码来源:DiagramLoader.php


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