php-doc-en/reference/domxml/functions/DomElement-has-attribute.xml
Mehdi Achour bf96e1dfcc Switch to new docs style
document php5 migration
document DomElement->remove_attribute()


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@188722 c90b9560-bf6c-de11-be94-00142212c4b1
2005-06-18 17:42:22 +00:00

103 lines
2.3 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.9 $ -->
<refentry id='function.domelement-has-attribute'>
<refnamediv>
<refname>DomElement->has_attribute()</refname>
<refpurpose>
Checks to see if an attribute exists in the current node
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<classsynopsis>
<ooclass><classname>DomElement</classname></ooclass>
<methodsynopsis>
<type>bool</type><methodname>has_attribute</methodname>
<methodparam><type>string</type><parameter>name</parameter></methodparam>
</methodsynopsis>
</classsynopsis>
<para>
This functions checks to see if an attribute named
<parameter>name</parameter> exists in the current node.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>
The name of the tested attribute.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; if the asked attribute exists, &false; otherwise.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Testing the existence of an attribute</title>
<programlisting role="php">
<![CDATA[
<?php
include("example.inc");
if (!$dom = domxml_open_mem($xmlstr)) {
echo "Error while parsing the document\n";
exit;
}
$root = $dom->document_element();
$buffer = '<html';
if ($root->has_attribute('language')) {
$buffer .= 'lang="' . $root->get_attribute('language') . '"';
}
$buffer .= '>';
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="migration">
<title>Migrating to PHP 5</title>
<para>
Use <xref linkend="function.dom-domelement-hasattribute" />.
</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
-->