本文整理匯總了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);
}
}