<?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.13 $ --> <refentry xml:id='function.domelement-set-attribute' xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>DomElement->set_attribute()</refname> <refpurpose> Sets the value of an attribute </refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <classsynopsis> <ooclass><classname>DomElement</classname></ooclass> <methodsynopsis> <type>DomAttribute</type><methodname>set_attribute</methodname> <methodparam><type>string</type><parameter>name</parameter></methodparam> <methodparam><type>string</type><parameter>value</parameter></methodparam> </methodsynopsis> </classsynopsis> <para> Sets an attribute with name <parameter>name</parameter> to the given <parameter>value</parameter>. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>name</parameter></term> <listitem> <para> The name of the attribute. If this attribute doesn't exist, it will be created. </para> </listitem> </varlistentry> <varlistentry> <term><parameter>value</parameter></term> <listitem> <para> The value of the attribute. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> Returns the old <classname>DomAttribute</classname> node, or the new one if you are creating the attribute for the first time. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>Setting an attribute</title> <programlisting role="php"> <![CDATA[ <?php $doc = domxml_new_doc("1.0"); $node = $doc->create_element("para"); $newnode = $doc->append_child($node); $newnode->set_attribute("align", "left"); ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="migration"> <title>Migrating to PHP 5</title> <para> Use <xref linkend="domelement.setattribute" />. </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><xref linkend="function.domelement-get-attribute-node" /></member> <member><xref linkend="function.domelement-get-attribute" /></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->