2004-01-23 16:17:17 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2008-07-24 21:54:47 +00:00
|
|
|
<!-- $Revision: 1.11 $ -->
|
2007-06-20 22:25:43 +00:00
|
|
|
<refentry xml:id='function.simplexml-element-attributes' xmlns="http://docbook.org/ns/docbook">
|
2007-01-15 23:53:55 +00:00
|
|
|
<refnamediv>
|
2008-07-24 21:54:47 +00:00
|
|
|
<refname>SimpleXMLElement->attributes</refname>
|
2007-01-15 23:53:55 +00:00
|
|
|
<refpurpose>Identifies an element's attributes</refpurpose>
|
|
|
|
</refnamediv>
|
2007-01-16 01:05:32 +00:00
|
|
|
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
2007-01-15 23:53:55 +00:00
|
|
|
<classsynopsis>
|
|
|
|
<ooclass><classname>SimpleXMLElement</classname></ooclass>
|
|
|
|
<methodsynopsis>
|
|
|
|
<type>SimpleXMLElement</type><methodname>attributes</methodname>
|
|
|
|
<methodparam choice="opt"><type>string</type><parameter>ns</parameter></methodparam>
|
|
|
|
<methodparam choice="opt"><type>bool</type><parameter>is_prefix</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
</classsynopsis>
|
|
|
|
<para>
|
|
|
|
This function provides the attributes and values defined within an xml tag.
|
|
|
|
</para>
|
|
|
|
&simplexml.iteration;
|
2007-01-16 01:05:32 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
<para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>ns</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
An optional namespace for the retrieved attributes
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>is_prefix</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Default to &false;
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
2007-01-15 23:53:55 +00:00
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title>Interpret an XML string</title>
|
|
|
|
<programlisting role="php">
|
2004-01-23 16:17:17 +00:00
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
$string = <<<XML
|
2007-01-16 01:05:32 +00:00
|
|
|
<a xmlns:b>
|
2004-01-23 16:17:17 +00:00
|
|
|
<foo name="one" game="lonely">1</foo>
|
|
|
|
</a>
|
|
|
|
XML;
|
|
|
|
|
|
|
|
$xml = simplexml_load_string($string);
|
|
|
|
foreach($xml->foo[0]->attributes() as $a => $b) {
|
|
|
|
echo $a,'="',$b,"\"\n";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
]]>
|
2007-01-15 23:53:55 +00:00
|
|
|
</programlisting>
|
2007-01-16 01:05:32 +00:00
|
|
|
&example.outputs;
|
2007-01-15 23:53:55 +00:00
|
|
|
<screen>
|
2004-01-23 16:17:17 +00:00
|
|
|
<![CDATA[
|
|
|
|
name="one"
|
|
|
|
game="lonely"
|
|
|
|
]]>
|
2007-01-15 23:53:55 +00:00
|
|
|
</screen>
|
|
|
|
</example>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
2007-01-16 01:05:32 +00:00
|
|
|
|
2007-01-15 23:53:55 +00:00
|
|
|
</refentry>
|
2004-01-23 16:17:17 +00:00
|
|
|
|
|
|
|
<!-- 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
|
|
|
|
-->
|