PHP 8.5.0 Released!

DOMElement::setAttributeNS

(PHP 5, PHP 7, PHP 8)

DOMElement::setAttributeNSİsim alanlı yeni bir öznitelik ekler

Açıklama

public DOMElement::setAttributeNS(?string $isimalanı, string $nitelikliAd, string $değer): void

nitelikliAd ve isimalanı belirtilen özniteliği tanımlar. Öznitelik düğümde mevcut değilse oluşturulur.

Bağımsız Değişkenler

isimalanı

İsim alanını betimleyen adres.

nitelikliAd

önek:öznitelik biçeminde öznitelik adı.

değer

Özniteliğin değeri.

Dönen Değerler

Hiçbir değer dönmez.

Hatalar/İstisnalar

DOM_NO_MODIFICATION_ALLOWED_ERR

Düğüm salt okunur ise oluşur.

DOM_NAMESPACE_ERR

isim uygun değilse veya bir önek belirtildiği halde uri olarak null verilmişse bu hata oluşur.

Ayrıca Bakınız

add a note

User Contributed Notes 1 note

up
5
catalinenache78 at gmail dot com
14 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'
    );
?>
To Top