# XML Parsing: a step beyond

**URL:** <https://forum.kirupa.com/t/xml-parsing-a-step-beyond/272259>\
**Category:** programming\
**Created:** [October 3, 2008, 10:04am UTC](https://forum.kirupa.com/t/xml-parsing-a-step-beyond/272259 "2008-10-03T10:04:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sukkulaati](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@sukkulaati](https://forum.kirupa.com/u/sukkulaati)\
**Post date:** [October 3, 2008, 10:04am UTC](https://forum.kirupa.com/t/xml-parsing-a-step-beyond/272259/1 "2008-10-03T10:04:28Z")

</div>

Hallo everybody! 🙂  
I’ve used the xml parsing method showed in [this](http://www.kirupa.com/web/xml_php_parse_intermediate.htm) tutorial and it has worked perfectly and saved me from many headaches.  
Now I have a problem: I am dealing with a xml that is a level deeper and I don’t know what to do.  
Starting from something like this:

```auto

<fruit>
         <[COLOR="#ff0000"]Apples[/COLOR]>
                <item>
                        <name>[COLOR="Blue"]Gala[/COLOR]</name>
                        <color>[COLOR="YellowGreen"]red[/COLOR]</color>
                </item>
                <item>
                        <name>Ginger Gold</name>
                        <color>yellow</color>
                </item>
        </apples>
        <Pears>
                <item>
                        <name>European Pear</name>
                        <color>brown</color>
                </item>
                <item>
                        <name>nashi pear</name>
                        <color>yellow</color>
                </item>
        </pears>
</fruit>

```

I want to get this:

```auto

<dl>
      <dt>[COLOR="Red"]Apples[/COLOR]</dt>
      <dd>The [COLOR="Blue"]Gala[/COLOR] fruit is [COLOR="YellowGreen"]red[/COLOR]</dd>
      <dd>The ... fruit is ...</dd>
      <!-- and so on -->

      <dt>Pears</dt>
      <dd>The ... fruit is ...</dd>
      <dd>The ... fruit is ...</dd>
</dl>

```

But I don’t know how!!  
Is there someone that can help me?  
Thank you!!
