<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.domelement.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'domelement.setattributens.php',
    1 => 'DOMElement::setAttributeNS',
    2 => 'Adds new attribute',
  ),
  'up' => 
  array (
    0 => 'class.domelement.php',
    1 => 'DOMElement',
  ),
  'prev' => 
  array (
    0 => 'domelement.setattributenodens.php',
    1 => 'DOMElement::setAttributeNodeNS',
  ),
  'next' => 
  array (
    0 => 'domelement.setidattribute.php',
    1 => 'DOMElement::setIdAttribute',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/dom/domelement/setattributens.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="domelement.setattributens" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">DOMElement::setAttributeNS</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">DOMElement::setAttributeNS</span> &mdash; <span class="dc-title">Adds new attribute</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-domelement.setattributens-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>DOMElement::setAttributeNS</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$namespace</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$qualifiedName</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$value</code></span>): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>

  <p class="para rdfs-comment">
   Sets an attribute with namespace <code class="parameter">namespace</code> and 
   name <code class="parameter">qualifiedName</code> to the given value. If the attribute
   does not exist, it will be created.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-domelement.setattributens-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">namespace</code></dt>
     <dd>
      <p class="para">
       The namespace URI.
      </p>
     </dd>
    
    
     <dt><code class="parameter">qualifiedName</code></dt>
     <dd>
      <p class="para">
       The qualified name of the attribute, as <code class="literal">prefix:tagname</code>.
      </p>
     </dd>
    
    
     <dt><code class="parameter">value</code></dt>
     <dd>
      <p class="para">
       The value of the attribute.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-domelement.setattributens-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   没有返回值。
  </p>
 </div>

 <div class="refsect1 errors" id="refsect1-domelement.setattributens-errors">
  <h3 class="title">错误／异常</h3>
  <p class="simpara">
   May throw a <span class="exceptionname"><a href="class.domexception.php" class="exceptionname">DOMException</a></span> with the
   following error codes:
  </p>
  <p class="para">
   <dl>
    
     <dt><strong><code><a href="dom.constants.php#constant.dom-no-modification-allowed-err">DOM_NO_MODIFICATION_ALLOWED_ERR</a></code></strong></dt>
     <dd>
      <p class="para">
       Raised if the node is readonly.
      </p>
     </dd>
    
    
     <dt><strong><code><a href="dom.constants.php#constant.dom-namespace-err">DOM_NAMESPACE_ERR</a></code></strong></dt>
     <dd>
      <p class="para">
       Raised if <code class="parameter">qualifiedName</code> is a malformed qualified
       name, or if <code class="parameter">qualifiedName</code> has a prefix and 
       <code class="parameter">namespace</code> is <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-domelement.setattributens-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="domelement.hasattributens.php" class="methodname" rel="rdfs-seeAlso">DOMElement::hasAttributeNS()</a> - Checks to see if attribute exists</span></li>
    <li><span class="methodname"><a href="domelement.getattributens.php" class="methodname" rel="rdfs-seeAlso">DOMElement::getAttributeNS()</a> - Returns value of attribute</span></li>
    <li><span class="methodname"><a href="domelement.removeattributens.php" class="methodname" rel="rdfs-seeAlso">DOMElement::removeAttributeNS()</a> - Removes attribute</span></li>
   </ul>
  </p>
 </div>

</div><?php manual_footer($setup); ?>