本文整理汇总了PHP中DOMElement::removeAttributeNS方法的典型用法代码示例。如果您正苦于以下问题:PHP DOMElement::removeAttributeNS方法的具体用法?PHP DOMElement::removeAttributeNS怎么用?PHP DOMElement::removeAttributeNS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMElement
的用法示例。
在下文中一共展示了DOMElement::removeAttributeNS方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: offsetUnset
/**
* Required by the ArrayAccess interface.
*
* @param string $offset
* @return boolean
*/
public function offsetUnset($offset)
{
if (strpos($offset, ':') !== false) {
list($ns, $attr) = explode(':', $offset, 2);
return $this->_element->removeAttributeNS(Zend_Feed::lookupNamespace($ns), $attr);
} else {
return $this->_element->removeAttribute($offset);
}
}
示例2: __construct
/**
* Create an AttributeValue.
*
* @param mixed $value The value of this element. Can be one of:
* - string Create an attribute value with a simple string.
* - DOMElement(AttributeValue) Create an attribute value of the given DOMElement.
* - DOMElement Create an attribute value with the given DOMElement as a child.
*/
public function __construct($value)
{
assert('is_string($value) || $value instanceof DOMElement');
if (is_string($value)) {
$doc = new DOMDocument();
$this->element = $doc->createElementNS(SAML2_Const::NS_SAML, 'saml:AttributeValue');
$this->element->setAttributeNS(SAML2_Const::NS_XSI, 'xsi:type', 'xs:string');
$this->element->appendChild($doc->createTextNode($value));
/* Make sure that the xs-namespace is available in the AttributeValue (for xs:string). */
$this->element->setAttributeNS(SAML2_Const::NS_XS, 'xs:tmp', 'tmp');
$this->element->removeAttributeNS(SAML2_Const::NS_XS, 'tmp');
return;
}
if ($value->namespaceURI === SAML2_Const::NS_SAML && $value->localName === 'AttributeValue') {
$this->element = SAML2_Utils::copyElement($value);
return;
}
$doc = new DOMDocument();
$this->element = $doc->createElementNS(SAML2_Const::NS_SAML, 'saml:AttributeValue');
SAML2_Utils::copyElement($value, $this->element);
}
示例3: offsetUnset
/**
* Required by the ArrayAccess interface.
*
* @internal
*/
public function offsetUnset($offset)
{
if (strpos($offset, ':') !== false) {
list($ns, $attr) = explode(':', $offset, 2);
$result = $this->_element->removeAttributeNS(Horde_Xml_Element::lookupNamespace($ns), $attr);
} else {
$result = $this->_element->removeAttribute($offset);
}
if ($result) {
$this->_expireCachedChildren();
return true;
} else {
return false;
}
}
示例4: cleanXlinkHrefs
/**
* Clean the xlink:hrefs of script and data embeds
*
* @param \DOMElement $element
*/
protected function cleanXlinkHrefs(\DOMElement &$element)
{
$xlinks = $element->getAttributeNS('http://www.w3.org/1999/xlink', 'href');
if (preg_match(self::SCRIPT_REGEX, $xlinks) === 1) {
$element->removeAttributeNS('http://www.w3.org/1999/xlink', 'href');
}
}
示例5: removeAttribute
/**
* Set an attribute on an element
*
* @param string $name
* @return bool
*/
public function removeAttribute($name)
{
list($namespace, $localName) = $this->resolveTagName($name);
if ($namespace != '') {
return parent::removeAttributeNS($namespace, $localName);
} else {
return parent::removeAttribute($name);
}
}