2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

Updated XMLRPC to 3.0.0 beta

This commit is contained in:
azammitdcarf
2011-11-14 04:27:30 +00:00
parent 3ac1c22bca
commit 242499a899
93 changed files with 20581 additions and 0 deletions

View File

@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 7. Class documentation</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" href="ch06s02.html" title="The Jellyfish Book" /><link rel="next" href="ch07s02.html" title="xmlrpcmsg" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 7. Class documentation</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch06s02.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch07s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="apidocs"></a>Chapter 7. Class documentation</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="ch07.html#xmlrpcval">xmlrpcval</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch07.html#id932680">Notes on types</a></span></dt><dt><span class="sect2"><a href="ch07.html#xmlrpcval-creation">Creation</a></span></dt><dt><span class="sect2"><a href="ch07.html#xmlrpcval-methods">Methods</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch07s02.html">xmlrpcmsg</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch07s02.html#id934064">Creation</a></span></dt><dt><span class="sect2"><a href="ch07s02.html#id934152">Methods</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch07s03.html">xmlrpc_client</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch07s03.html#id934526">Creation</a></span></dt><dt><span class="sect2"><a href="ch07s03.html#id934666">Methods</a></span></dt><dt><span class="sect2"><a href="ch07s03.html#id935796">Variables</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch07s04.html">xmlrpcresp</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch07s04.html#id935884">Creation</a></span></dt><dt><span class="sect2"><a href="ch07s04.html#id935971">Methods</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch07s05.html">xmlrpc_server</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch07s05.html#id936390">Method handler functions</a></span></dt><dt><span class="sect2"><a href="ch07s05.html#id936453">The dispatch map</a></span></dt><dt><span class="sect2"><a href="ch07s05.html#signatures">Method signatures</a></span></dt><dt><span class="sect2"><a href="ch07s05.html#id936613">Delaying the server response</a></span></dt><dt><span class="sect2"><a href="ch07s05.html#id936662">Modifying the server behaviour</a></span></dt><dt><span class="sect2"><a href="ch07s05.html#id936748">Fault reporting</a></span></dt><dt><span class="sect2"><a href="ch07s05.html#id937308">'New style' servers</a></span></dt></dl></dd></dl></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="xmlrpcval"></a>xmlrpcval</h2></div></div></div><p>This is where a lot of the hard work gets done. This class enables
the creation and encapsulation of values for XML-RPC.</p><p>Ensure you've read the XML-RPC spec at <a class="ulink" href="http://www.xmlrpc.com/stories/storyReader$7" target="_top">http://www.xmlrpc.com/stories/storyReader$7</a>
before reading on as it will make things clearer.</p><p>The <code class="classname">xmlrpcval</code> class can store arbitrarily
complicated values using the following types: <code class="literal">i4 int boolean
string double dateTime.iso8601 base64 array struct</code>
<code class="literal">null</code>. You should refer to the <a class="ulink" href="http://www.xmlrpc.com/spec" target="_top">spec</a> for more information on
what each of these types mean.</p><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id932680"></a>Notes on types</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id932686"></a>int</h4></div></div></div><p>The type <code class="classname">i4</code> is accepted as a synonym
for <code class="classname">int</code> when creating xmlrpcval objects. The
xml parsing code will always convert <code class="classname">i4</code> to
<code class="classname">int</code>: <code class="classname">int</code> is regarded
by this implementation as the canonical name for this type.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id932715"></a>base64</h4></div></div></div><p>Base 64 encoding is performed transparently to the caller when
using this type. Decoding is also transparent. Therefore you ought
to consider it as a "binary" data type, for use when you want to
pass data that is not 7-bit clean.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id932726"></a>boolean</h4></div></div></div><p>The php values <code class="literal">true</code> and
<code class="literal">1</code> map to <code class="literal">true</code>. All other
values (including the empty string) are converted to
<code class="literal">false</code>.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id932751"></a>string</h4></div></div></div><p>Characters &lt;, &gt;, ', ", &amp;, are encoded using their
entity reference as &amp;lt; &amp;gt; &amp;apos; &amp;quot; and
&amp;amp; All other characters outside of the ASCII range are
encoded using their character reference representation (e.g.
&amp;#200 for é). The XML-RPC spec recommends only encoding
<code class="literal">&lt; &amp;</code> but this implementation goes further,
for reasons explained by <a class="ulink" href="http://www.w3.org/TR/REC-xml#syntax" target="_top">the XML 1.0
recommendation</a>. In particular, using character reference
representation has the advantage of producing XML that is valid
independently of the charset encoding assumed.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id932770"></a>null</h4></div></div></div><p>There is no support for encoding <code class="literal">null</code>
values in the XML-RPC spec, but at least a couple of extensions (and
many toolkits) do support it. Before using <code class="literal">null</code>
values in your messages, make sure that the responding party accepts
them, and uses the same encoding convention (see ...).</p></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="xmlrpcval-creation"></a>Creation</h3></div></div></div><p>The constructor is the normal way to create an
<code class="classname">xmlrpcval</code>. The constructor can take these
forms:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcvalnew
<b class="fsfunc">xmlrpcval</b>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcvalnew
<b class="fsfunc">xmlrpcval</b>(</code></td><td>string<var class="pdparam">$stringVal</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcvalnew
<b class="fsfunc">xmlrpcval</b>(</code></td><td>mixed<var class="pdparam">$scalarVal</var>, </td></tr><tr><td> </td><td>string<var class="pdparam">$scalartyp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcvalnew
<b class="fsfunc">xmlrpcval</b>(</code></td><td>array<var class="pdparam">$arrayVal</var>, </td></tr><tr><td> </td><td>string<var class="pdparam">$arraytyp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>The first constructor creates an empty value, which must be
altered using the methods <code class="function">addScalar</code>,
<code class="function">addArray</code> or <code class="function">addStruct</code> before
it can be used.</p><p>The second constructor creates a simple string value.</p><p>The third constructor is used to create a scalar value. The
second parameter must be a name of an XML-RPC type. Valid types are:
"<code class="literal">int</code>", "<code class="literal">boolean</code>",
"<code class="literal">string</code>", "<code class="literal">double</code>",
"<code class="literal">dateTime.iso8601</code>", "<code class="literal">base64</code>" or
"null".</p><p>Examples:</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">$myInt&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcvalue</span><span style="color: #007700">(</span><span style="color: #0000BB">1267</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"int"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$myString&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcvalue</span><span style="color: #007700">(</span><span style="color: #DD0000">"Hello,&nbsp;World!"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"string"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$myBool&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcvalue</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"boolean"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$myString2&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcvalue</span><span style="color: #007700">(</span><span style="color: #0000BB">1.24</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"string"</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;note:&nbsp;this&nbsp;will&nbsp;serialize&nbsp;a&nbsp;php&nbsp;float&nbsp;value&nbsp;as&nbsp;xmlrpc&nbsp;string</span>
</span>
</code></pre><p>The fourth constructor form can be used to compose complex
XML-RPC values. The first argument is either a simple array in the
case of an XML-RPC <code class="classname">array</code> or an associative
array in the case of a <code class="classname">struct</code>. The elements of
the array <span class="emphasis"><em>must be <code class="classname">xmlrpcval</code> objects
themselves</em></span>.</p><p>The second parameter must be either "<code class="literal">array</code>"
or "<code class="literal">struct</code>".</p><p>Examples:</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">$myArray&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(<br />&nbsp;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #DD0000">"Tom"</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #DD0000">"Dick"</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #DD0000">"Harry"</span><span style="color: #007700">)<br />&nbsp;&nbsp;),<br />&nbsp;&nbsp;</span><span style="color: #DD0000">"array"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;recursive&nbsp;struct<br /></span><span style="color: #0000BB">$myStruct&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(<br />&nbsp;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"name"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #DD0000">"Tom"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"string"</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"age"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #0000BB">34</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"int"</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"address"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"street"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #DD0000">"Fifht&nbsp;Ave"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"string"</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"city"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #DD0000">"NY"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"string"</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;),&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"struct"</span><span style="color: #007700">)<br />&nbsp;&nbsp;),&nbsp;<br />&nbsp;&nbsp;</span><span style="color: #DD0000">"struct"</span><span style="color: #007700">);</span>
</span>
</code></pre><p>See the file <code class="literal">vardemo.php</code> in this distribution
for more examples.</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="xmlrpcval-methods"></a>Methods</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id933111"></a>addScalar</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int<b class="fsfunc">addScalar</b>(</code></td><td>string<var class="pdparam">$stringVal</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int<b class="fsfunc">addScalar</b>(</code></td><td>mixed<var class="pdparam">$scalarVal</var>, </td></tr><tr><td> </td><td>string<var class="pdparam">$scalartyp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>If <em class="parameter"><code>$val</code></em> is an empty
<code class="classname">xmlrpcval</code> this method makes it a scalar
value, and sets that value.</p><p>If <em class="parameter"><code>$val</code></em> is already a scalar value, then
no more scalars can be added and <code class="literal">0</code> is
returned.</p><p>If <em class="parameter"><code>$val</code></em> is an xmlrpcval of type array,
the php value <em class="parameter"><code>$scalarval</code></em> is added as its last
element.</p><p>If all went OK, <code class="literal">1</code> is returned, otherwise
<code class="literal">0</code>.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id933209"></a>addArray</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int<b class="fsfunc">addArray</b>(</code></td><td>array<var class="pdparam">$arrayVal</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>The argument is a simple (numerically indexed) array. The
elements of the array <span class="emphasis"><em>must be
<code class="classname">xmlrpcval</code> objects
themselves</em></span>.</p><p>Turns an empty <code class="classname">xmlrpcval</code> into an
<code class="classname">array</code> with contents as specified by
<em class="parameter"><code>$arrayVal</code></em>.</p><p>If <em class="parameter"><code>$val</code></em> is an xmlrpcval of type array,
the elements of <em class="parameter"><code>$arrayVal</code></em> are appended to the
existing ones.</p><p>See the fourth constructor form for more information.</p><p>If all went OK, <code class="literal">1</code> is returned, otherwise
<code class="literal">0</code>.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id933290"></a>addStruct</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int<b class="fsfunc">addStruct</b>(</code></td><td>array<var class="pdparam">$assocArrayVal</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>The argument is an associative array. The elements of the
array <span class="emphasis"><em>must be <code class="classname">xmlrpcval</code> objects
themselves</em></span>.</p><p>Turns an empty <code class="classname">xmlrpcval</code> into a
<code class="classname">struct</code> with contents as specified by
<em class="parameter"><code>$assocArrayVal</code></em>.</p><p>If <em class="parameter"><code>$val</code></em> is an xmlrpcval of type struct,
the elements of <em class="parameter"><code>$arrayVal</code></em> are merged with the
existing ones.</p><p>See the fourth constructor form for more information.</p><p>If all went OK, <code class="literal">1</code> is returned, otherwise
<code class="literal">0</code>.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id933370"></a>kindOf</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">string<b class="fsfunc">kindOf</b>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns a string containing "struct", "array" or "scalar"
describing the base type of the value. If it returns "undef" it
means that the value hasn't been initialised.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id933398"></a>serialize</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">string<b class="fsfunc">serialize</b>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns a string containing the XML-RPC representation of this
value.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id933425"></a>scalarVal</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">mixed<b class="fsfunc">scalarVal</b>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div></div><p>If <code class="function">$val-&gt;kindOf() == "scalar"</code>, this
method returns the actual PHP-language value of the scalar (base 64
decoding is automatically handled here).</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id933457"></a>scalarTyp</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">string<b class="fsfunc">scalarTyp</b>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div></div><p>If <code class="function">$val-&gt;kindOf() == "scalar"</code>, this
method returns a string denoting the type of the scalar. As
mentioned before, <code class="literal">i4</code> is always coerced to
<code class="literal">int</code>.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id933779"></a>arrayMem</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcval<b class="fsfunc">arrayMem</b>(</code></td><td>int<var class="pdparam">$n</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>If <code class="function">$val-&gt;kindOf() == "array"</code>, returns
the <em class="parameter"><code>$n</code></em>th element in the array represented by
the value <em class="parameter"><code>$val</code></em>. The value returned is an
<code class="classname">xmlrpcval</code> object.</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #FF8000">//&nbsp;iterating&nbsp;over&nbsp;values&nbsp;of&nbsp;an&nbsp;array&nbsp;object<br /></span><span style="color: #007700">for&nbsp;(</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">&lt;&nbsp;</span><span style="color: #0000BB">$val</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">arraySize</span><span style="color: #007700">();&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">++)<br />{<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$v&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$val</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">arrayMem</span><span style="color: #007700">(</span><span style="color: #0000BB">$i</span><span style="color: #007700">);<br />&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Element&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #DD0000">&nbsp;of&nbsp;the&nbsp;array&nbsp;is&nbsp;of&nbsp;type&nbsp;"</span><span style="color: #007700">.</span><span style="color: #0000BB">$v</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">kindOf</span><span style="color: #007700">();<br />}</span>
</span>
</code></pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id933833"></a>arraySize</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int<b class="fsfunc">arraySize</b>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div></div><p>If <em class="parameter"><code>$val</code></em> is an
<code class="classname">array</code>, returns the number of elements in that
array.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id933869"></a>structMem</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcval<b class="fsfunc">structMem</b>(</code></td><td>string<var class="pdparam">$memberName</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>If <code class="function">$val-&gt;kindOf() == "struct"</code>, returns
the element called <em class="parameter"><code>$memberName</code></em> from the
struct represented by the value <em class="parameter"><code>$val</code></em>. The
value returned is an <code class="classname">xmlrpcval</code> object.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id933915"></a>structEach</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">array<b class="fsfunc">structEach</b>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns the next (key, value) pair from the struct, when
<em class="parameter"><code>$val</code></em> is a struct.
<em class="parameter"><code>$value</code></em> is an xmlrpcval itself. See also <a class="xref" href="ch07.html#structreset" title="structReset">structreset()</a>.</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #FF8000">//&nbsp;iterating&nbsp;over&nbsp;all&nbsp;values&nbsp;of&nbsp;a&nbsp;struct&nbsp;object<br /></span><span style="color: #0000BB">$val</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">structreset</span><span style="color: #007700">();<br />while&nbsp;(list(</span><span style="color: #0000BB">$key</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$v</span><span style="color: #007700">)&nbsp;=&nbsp;</span><span style="color: #0000BB">$val</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">structEach</span><span style="color: #007700">())<br />{<br />&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Element&nbsp;</span><span style="color: #0000BB">$key</span><span style="color: #DD0000">&nbsp;of&nbsp;the&nbsp;struct&nbsp;is&nbsp;of&nbsp;type&nbsp;"</span><span style="color: #007700">.</span><span style="color: #0000BB">$v</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">kindOf</span><span style="color: #007700">();<br />}</span>
</span>
</code></pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="structreset"></a>structReset</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void<b class="fsfunc">structReset</b>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div></div><p>Resets the internal pointer for
<code class="function">structEach()</code> to the beginning of the struct,
where <em class="parameter"><code>$val</code></em> is a struct.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="structmemexists"></a>structMemExists</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">bool<b class="fsfunc">structMemExsists</b>(</code></td><td>string<var class="pdparam">$memberName</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns <code class="constant">TRUE</code> or
<code class="constant">FALSE</code> depending on whether a member of the
given name exists in the struct.</p></div></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch06s02.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch07s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The Jellyfish Book </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> xmlrpcmsg</td></tr></table></div></body></html>