downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

DOMElement::setIdAttribute> <DOMElement::setAttributeNodeNS
[edit] Last updated: Sun, 26 May 2013

view this page in

DOMElement::setAttributeNS

(PHP 5)

DOMElement::setAttributeNSAñade un nuevo atributo

Descripción

void DOMElement::setAttributeNS ( string $namespaceURI , string $qualifiedName , string $value )

Establece un atributo con el espacio de nombres namespaceURI y el nombre name al valor dado. Si el atributo no existe, se creará.

Parámetros

namespaceURI

La URI del espacio de nombres.

qualifiedName

El nombre cualificado del atributo, como prefijo:nombre_etiqueta.

value

El valor del atributo.

Valores devueltos

No devuelve ningún valor.

Errores/Excepciones

DOM_NO_MODIFICATION_ALLOWED_ERR

Lanzado si el nodo es de sólo lectura.

DOM_NAMESPACE_ERR

Lanzado si qualifiedName es un nombre cualificado malformado, o si qualifiedName tienen un prefijo y namespaceURI es NULL.

Ver también



add a note add a note User Contributed Notes DOMElement::setAttributeNS - [1 notes]
up
1
catalinenache78 at gmail dot com
2 years ago
To add new brand xml namespace use:

<?php
    $element
->setAttributeNS(
       
'http://www.w3.org/2000/xmlns/', // xmlns namespace URI
       
'xmlns:mynamespace',
       
'example.com/mynamespace'
   
);
?>

'http://www.w3.org/2000/xmlns/' URI is important
to be able to add  new namespaces !!!

Later you can use your namespace like:

<?php
    $element
->setAttributeNS(
       
'example.com/mynamespace',
       
'mynamespace:something',
       
'value'
   
);
?>

 
show source | credits | sitemap | contact | advertising | mirror sites