<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.xmlwriter.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'xmlwriter.writeattribute.php',
    1 => 'XMLWriter::writeAttribute',
    2 => 'Write full attribute',
  ),
  'up' => 
  array (
    0 => 'class.xmlwriter.php',
    1 => 'XMLWriter',
  ),
  'prev' => 
  array (
    0 => 'xmlwriter.touri.php',
    1 => 'XMLWriter::toUri',
  ),
  'next' => 
  array (
    0 => 'xmlwriter.writeattributens.php',
    1 => 'XMLWriter::writeAttributeNs',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/xmlwriter/xmlwriter/writeattribute.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="xmlwriter.writeattribute" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">XMLWriter::writeAttribute</h1>
  <h1 class="refname">xmlwriter_write_attribute</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.1.2, PHP 7, PHP 8, PECL xmlwriter &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">XMLWriter::writeAttribute</span> -- <span class="refname">xmlwriter_write_attribute</span> &mdash; <span class="dc-title">Write full attribute</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-xmlwriter.writeattribute-description">
  <h3 class="title">Descrizione</h3>
  <p class="para">Stile orientato agli oggetti</p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>XMLWriter::writeAttribute</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$name</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.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">Stile procedurale</p>
  <div class="methodsynopsis dc-description"><span class="methodname"><strong>xmlwriter_write_attribute</strong></span>(<span class="methodparam"><span class="type"><a href="class.xmlwriter.php" class="type XMLWriter">XMLWriter</a></span> <code class="parameter">$writer</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$name</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.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   Writes a full attribute.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-xmlwriter.writeattribute-parameters">
  <h3 class="title">Elenco dei parametri</h3>
  <p class="para">
   <dl>
    <dt><code class="parameter">
xmlwriter</code></dt><dd><p class="para">Solo per chiamate procedurali. 
La <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> XMLWriter che è stata modificata. Questa risorsa deriva da una chiamata a <span class="function"><a href="xmlwriter.openuri.php" class="function">xmlwriter_open_uri()</a></span> or <span class="function"><a href="xmlwriter.openmemory.php" class="function">xmlwriter_open_memory()</a></span>.</p></dd>
    
     <dt><code class="parameter">name</code></dt>
     <dd>
      <p class="para">
       The name of the attribute.
      </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-xmlwriter.writeattribute-returnvalues">
  <h3 class="title">Valori restituiti</h3>
  <p class="para">
   Restituisce <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> in caso di successo, <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> in caso di fallimento.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-xmlwriter.writeattribute-changelog">
  <h3 class="title">Log delle modifiche</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Versione</th>
      <th>Descrizione</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
 <td>8.0.0</td>
 <td>
  <code class="parameter">writer</code> expects an <span class="classname"><a href="class.xmlwriter.php" class="classname">XMLWriter</a></span>
  instance now; previously, a <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> was expected.
 </td>
</tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-xmlwriter.writeattribute-examples">
  <h3 class="title">Esempi</h3>
  <div class="example" id="xmlwriter-write-attribute.example.intermix">
   <p><strong>Example #1 Intermixing Sub-elements and Attributes</strong></p>
   <div class="example-contents"><p>
     If writing sub-elements and attributes is intermixed, any attempt to write
     attributes after the first sub-element will fail and return false.
   </p></div>
   <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$xml </span><span style="color: #007700">= new </span><span style="color: #0000BB">XMLWriter</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$xml</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">openMemory</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">$xml</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">startElement</span><span style="color: #007700">(</span><span style="color: #DD0000">'element'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$xml</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">writeAttribute</span><span style="color: #007700">(</span><span style="color: #DD0000">'attr1'</span><span style="color: #007700">, </span><span style="color: #DD0000">'0'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$xml</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">writeElement</span><span style="color: #007700">(</span><span style="color: #DD0000">'subelem'</span><span style="color: #007700">, </span><span style="color: #DD0000">'0'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$xml</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">writeAttribute</span><span style="color: #007700">(</span><span style="color: #DD0000">'attr2'</span><span style="color: #007700">, </span><span style="color: #DD0000">'0'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$xml</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">endElement</span><span style="color: #007700">();<br /><br />echo </span><span style="color: #0000BB">$xml</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">flush</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Il precedente esempio visualizzerà:</p></div>
   <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">bool(false)
&lt;element attr1=&quot;0&quot;&gt;&lt;subelem&gt;0&lt;/subelem&gt;&lt;/element&gt;</pre>
</div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-xmlwriter.writeattribute-seealso">
  <h3 class="title">Vedere anche:</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="xmlwriter.writeattributens.php" class="methodname" rel="rdfs-seeAlso">XMLWriter::writeAttributeNs()</a> - Write full namespaced attribute</span></li>
    <li><span class="methodname"><a href="xmlwriter.startattribute.php" class="methodname" rel="rdfs-seeAlso">XMLWriter::startAttribute()</a> - Create start attribute</span></li>
    <li><span class="methodname"><a href="xmlwriter.startattributens.php" class="methodname" rel="rdfs-seeAlso">XMLWriter::startAttributeNs()</a> - Create start namespaced attribute</span></li>
    <li><span class="methodname"><a href="xmlwriter.endattribute.php" class="methodname" rel="rdfs-seeAlso">XMLWriter::endAttribute()</a> - End attribute</span></li>
   </ul>
  </p>
 </div>



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