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


PHP DOMElement::getAttributeNS方法代码示例

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


在下文中一共展示了DOMElement::getAttributeNS方法的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: filterElement

 /**
  * Filter a single element.
  *
  * @param DOMElement $element
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $currentLevel = $element->getAttributeNS(ezcDocumentOdt::NS_ODT_TEXT, 'outline-level');
     $parent = $element->parentNode;
     $siblings = $parent->childNodes;
     $section = new ezcDocumentPropertyContainerDomElement('section', null, ezcDocumentOdt::NS_EZC);
     $parent->replaceChild($section, $element);
     $section->setProperty('type', 'section');
     $section->setProperty('level', $currentLevel);
     $section->appendChild($element);
     $element->setProperty('type', 'title');
     for ($i = 0; $i < $siblings->length; ++$i) {
         if ($siblings->item($i)->isSameNode($section)) {
             break;
         }
     }
     ++$i;
     while (($sibling = $siblings->item($i)) !== null) {
         if ($sibling->nodeType === XML_ELEMENT_NODE && $sibling->namespaceURI === ezcDocumentOdt::NS_EZC && $sibling->getProperty('level') <= $currentLevel) {
             // Reached next higher or same level section
             break;
         }
         $section->appendChild($sibling->cloneNode(true));
         $parent->removeChild($sibling);
     }
 }
开发者ID:bmdevel,项目名称:ezc,代码行数:32,代码来源:header.php

示例5: __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

示例6: offsetGet

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

示例7: getAttribute

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

示例8: filterElement

 /**
  * Filter a single element.
  *
  * @param DOMElement $element
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $element->setProperty('type', 'ulink');
     $attrs = $element->getProperty('attributes');
     if (!is_array($attrs)) {
         $attrs = array();
     }
     // @todo: Can we convert more attributes here? Maybe <ulink type="…"/>?
     $attrs['url'] = $element->getAttributeNS(ezcDocumentOdt::NS_XLINK, 'href');
     $element->setProperty('attributes', $attrs);
 }
开发者ID:axelmdev,项目名称:ecommerce,代码行数:17,代码来源:link.php

示例9: filterElement

 /**
  * Filter a single element.
  *
  * @param DOMElement $element
  * @return void
  */
 public function filterElement(DOMElement $element)
 {
     $spaces = '';
     switch ($element->localName) {
         case 's':
             $count = $element->getAttributeNS(ezcDocumentOdt::NS_ODT_TEXT, 'c');
             $spaces = str_repeat(' ', $count !== '' ? (int) $count : 1);
             break;
         case 'tab':
             $spaces = "\t";
             break;
         case 'line-break':
             $spaces = "\n";
             break;
     }
     $element->setProperty('spaces', $spaces);
 }
开发者ID:axelmdev,项目名称:ecommerce,代码行数:23,代码来源:whitespace.php

示例10: unserialize

    /**
     * Unserialize xml structure. Creates an object from xml input.
     *
     * Transaction unsafe. If you call several transaction unsafe methods you must enclose
     * the calls within a db transaction; thus within db->begin and db->commit.
     *
     * @param mixed $package
     * @param DOMElement $domNode
     * @param array $options
     * @param int|bool $ownerID Override owner ID, null to use XML owner id (optional)
     * @param string $handlerType
     * @return array|bool|eZContentObject|null created object, false if could not create object/xml invalid
     */
    static function unserialize( $package, $domNode, &$options, $ownerID = false, $handlerType = 'ezcontentobject' )
    {
        if ( $domNode->localName != 'object' )
        {
            $retValue = false;
            return $retValue;
        }

        $initialLanguage = eZContentObject::mapLanguage( $domNode->getAttribute( 'initial_language' ), $options );
        if( $initialLanguage === 'skip' )
        {
            $retValue = true;
            return $retValue;
        }

        $sectionID = $domNode->getAttributeNS( 'http://ez.no/ezobject', 'section_id' );
        if ( $ownerID === false )
        {
            $ownerID = $domNode->getAttributeNS( 'http://ez.no/ezobject', 'owner_id' );
        }
        $remoteID = $domNode->getAttribute( 'remote_id' );
        $name = $domNode->getAttribute( 'name' );
        $classRemoteID = $domNode->getAttribute( 'class_remote_id' );
        $classIdentifier = $domNode->getAttributeNS( 'http://ez.no/ezobject', 'class_identifier' );
        $alwaysAvailable = ( $domNode->getAttributeNS( 'http://ez.no/ezobject', 'always_available' ) == '1' );

        $contentClass = eZContentClass::fetchByRemoteID( $classRemoteID );
        if ( !$contentClass )
        {
            $contentClass = eZContentClass::fetchByIdentifier( $classIdentifier );
        }

        if ( !$contentClass )
        {
            $options['error'] = array( 'error_code' => self::PACKAGE_ERROR_NO_CLASS,
                                       'element_id' => $remoteID,
                                       'description' => "Can't install object '$name': Unable to fetch class with remoteID: $classRemoteID." );
            $retValue = false;
            return $retValue;
        }

        /** @var DOMElement $versionListNode */
        $versionListNode = $domNode->getElementsByTagName( 'version-list' )->item( 0 );

        $importedLanguages = array();
        foreach( $versionListNode->getElementsByTagName( 'version' ) as $versionDOMNode )
        {
            /** @var DOMElement $versionDOMNode */
            foreach ( $versionDOMNode->getElementsByTagName( 'object-translation' ) as $versionDOMNodeChild )
            {
                /** @var DOMElement $versionDOMNodeChild */
                $importedLanguage = eZContentObject::mapLanguage( $versionDOMNodeChild->getAttribute( 'language' ), $options );
                $language = eZContentLanguage::fetchByLocale( $importedLanguage );
                // Check if the language is allowed in this setup.
                if ( $language )
                {
                    $hasTranslation = true;
                }
                else
                {
                    if ( $importedLanguage == 'skip' )
                        continue;

                    // if there is no needed translation in system then add it
                    $locale = eZLocale::instance( $importedLanguage );
                    $translationName = $locale->internationalLanguageName();
                    $translationLocale = $locale->localeCode();

                    if ( $locale->isValid() )
                    {
                        eZContentLanguage::addLanguage( $locale->localeCode(), $locale->internationalLanguageName() );
                        $hasTranslation = true;
                    }
                    else
                        $hasTranslation = false;
                }
                if ( $hasTranslation )
                {
                    $importedLanguages[] = $importedLanguage;
                    $importedLanguages = array_unique( $importedLanguages );
                }
            }
        }

        // If object exists we return a error.
        // Minimum install element is an object now.

//.........这里部分代码省略.........
开发者ID:ezsystemstraining,项目名称:ez54training,代码行数:101,代码来源:ezcontentobject.php

示例11: 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

示例12: isOptional

 /**
  * @return bool
  */
 public function isOptional()
 {
     return $this->element->getAttributeNS('http://www.w3.org/1999/xlink', 'use') == 'optional';
 }
开发者ID:adrianclay,项目名称:xbrl,代码行数:7,代码来源:Arc.php

示例13: getRole

 /**
  * @return string
  */
 public function getRole()
 {
     return $this->element->getAttributeNS('http://www.w3.org/1999/xlink', 'role');
 }
开发者ID:adrianclay,项目名称:xbrl,代码行数:7,代码来源:ArcCollection.php

示例14: retrieveListStyle

 /**
  * Returns the <text:list-style> DOMElement assigned to $odtList.
  * 
  * @param DOMElement $odtList 
  * @param ezcDocumentOdtStyleInformation $styleInfo 
  * @return DOMElement
  */
 protected function retrieveListStyle($odtList, ezcDocumentOdtStyleInformation $styleInfo)
 {
     $styleName = $odtList->getAttributeNS(ezcDocumentOdt::NS_ODT_TEXT, 'style-name');
     $xpath = new DOMXpath($styleInfo->automaticStyleSection->ownerDocument);
     $xpath->registerNamespace(ezcDocumentOdt::NS_ODT_TEXT, 'text');
     $xpath->registerNamespace(ezcDocumentOdt::NS_ODT_STYLE, 'style');
     $styleList = $xpath->query("text:list-style[@style:name='{$styleName}']", $styleInfo->automaticStyleSection);
     if ($styleList->length !== 1) {
         throw new RuntimeException("Inconsistent style section. Found {$styleList->length} list styles with name '{$styleName}'");
     }
     return $styleList->item(0);
 }
开发者ID:bmdevel,项目名称:ezc,代码行数:19,代码来源:list.php

示例15: 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


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