next() element SimpleXML
<p>I have an XML file:</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;dc&gt;
    &lt;category&gt;
        &lt;name&gt;Personal Information&lt;/name&gt;
        &lt;type&gt;
            &lt;name&gt;Age or Range&lt;/name&gt;
            &lt;item dc-numeric="1"&gt;Record 1&lt;/item&gt;
            &lt;item dc-numeric="2"&gt;Record 2&lt;/item&gt;
            &lt;item dc-numeric="3"&gt;Record 3&lt;/item&gt;
        &lt;/type&gt;

        &lt;type&gt;
            &lt;name&gt;Preferences&lt;/name&gt;
            &lt;item dc-numeric="1"&gt;Record 1&lt;/item&gt;
            &lt;item dc-numeric="2"&gt;Record 2&lt;/item&gt;
            &lt;item dc-numeric="3"&gt;Record 3&lt;/item&gt;
        &lt;/type&gt;         
    &lt;/category&gt;

    &lt;category&gt;
        &lt;name&gt;Product Information&lt;/name&gt;
        &lt;type&gt;
            &lt;name&gt;Intellectual Property&lt;/name&gt;
            &lt;item dc-numeric="1"&gt;Record 1&lt;/item&gt;
            &lt;item dc-numeric="2"&gt;Record 2&lt;/item&gt;
            &lt;item dc-numeric="3"&gt;Record 3&lt;/item&gt;
        &lt;/type&gt;
    &lt;/category&gt;

    &lt;category&gt;
        &lt;name&gt;Business Information&lt;/name&gt;
        &lt;type&gt;
            &lt;name&gt;Business Records&lt;/name&gt;
            &lt;item dc-numeric="1"&gt;Record 1&lt;/item&gt;
            &lt;item dc-numeric="2"&gt;Record 2&lt;/item&gt;
            &lt;item dc-numeric="3"&gt;Record 3&lt;/item&gt;
        &lt;/type&gt;
    &lt;/category&gt;
&lt;/dc&gt;
</code></pre>

<p>I am parsing the file with a PHP <code>foreach</code>, but having trouble with the <code>next()</code> function:</p>

<pre><code>&lt;?php foreach ($xml as $category) : ?&gt;

    &lt;?php echo $category-&gt;name; ?&gt;
        &lt;br /&gt;&lt;li&gt;&lt;?php prev($category); ?&gt; | &lt;?php next($category); ?&gt;&lt;/li&gt;

&lt;?php endforeach; ?&gt;
</code></pre>

<p>I am trying to get the following output to show the previous / next <code>categories-&gt;name</code> in the XML: </p>

<p>Personal Information</p>

<ul>
<li>Product Information</li>
</ul>

<p>Product Information</p>

<ul>
<li>Personal Information | Business Information</li>
</ul>