# DOMXML question!

**URL:** <https://forum.kirupa.com/t/domxml-question/285122>\
**Category:** programming\
**Created:** [March 27, 2009, 7:24am UTC](https://forum.kirupa.com/t/domxml-question/285122 "2009-03-27T07:24:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhase](https://avatars.discourse-cdn.com/v4/letter/m/dc4da7/32.png) [@mhase](https://forum.kirupa.com/u/mhase)\
**Post date:** [March 27, 2009, 7:24am UTC](https://forum.kirupa.com/t/domxml-question/285122/1 "2009-03-27T07:24:36Z")

</div>

How would it be possible to access the value stored within the child of a child element? To access the children, I am currently using:

```auto

function extractText($array){
    if(count($array) <= 1){
        for ($i = 0; $i<count($array); $i++){
            $node = $array[$i];
            $value = $node->get_content();
        }
        return $value;
    }   
}

```

in conjunction with

```auto

$xml = domxml_open_file($filename);
    $root = $xml->root();
    $id = $root->get_attribute("id");

    $t1_array = $root->get_elements_by_tagname("title");
    $title = extractText($t1_array);

```

to get the value of a child… I just can’t figure out the way to access the child of that child. for example:

```auto

<parent>[INDENT]<child>[INDENT]<child1> <---
<child2> <--- problem areas
<child3> <---
[/INDENT][/INDENT]

```

Thanks brothers. :samuelljackson:

(script from [http://www.sitepoint.com/article/management-system-php/1/](http://www.sitepoint.com/article/management-system-php/1/))
