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: Fri, 24 Jun 2011

view this page in

DOMElement::setAttributeNS

(PHP 5)

DOMElement::setAttributeNSاضافه کردن ویژگی جدید

Description

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

تعیین ویژگی با فضای نام namespaceURI و نام name به مقدار داده شده. اگر ویژگی وجود نداشته باشد ساخته می‌شود.

Parameters

namespaceURI

فضای نام URI.

qualifiedName

نام مناسب ویژگی به عنوان prefix:tagname.

value

مقدار ویژگی.

Return Values

No value is returned.

Errors/Exceptions

DOM_NO_MODIFICATION_ALLOWED_ERR

ایجاد اگر گره فقط خواندنی باشد.

DOM_NAMESPACE_ERR

ایجاد اگر qualifiedName نام ناقص باشد یا اگر qualifiedName پیشوند داشته باشد و namespaceURI NULL باشد.

See Also



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 | stats | sitemap | contact | advertising | mirror sites