i have xml file

```
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<comments
    xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
    <authors>
        <author></author>
    </authors>
    <commentList>
        <comment authorId="0" ref="G2">
            <text>
                <t xml:space="preserve"> test comment 1</t>
            </text>
        </comment>
        <comment authorId="0" ref="G4">
            <text>
                <t xml:space="preserve"> test comment 2</t>
            </text>
        </comment>
    </commentList>
</comments>

```

i load it through SimpleXMLElement php function

```
$com = new SimpleXMLElement('data.xml');

```

when i print\_r($com) i get

```
SimpleXMLElement Object
(
    [authors] => SimpleXMLElement Object
        (
            [0] => SimpleXMLElement Object
                ()
        )
    [commentList] => SimpleXMLElement Object
        (
            [comment] => Array
                (
                    [0] => SimpleXMLElement Object
                        (
                            [@attributes] => Array
                                (
                                    [authorId] => 0
                                    [ref] => G2
                                )
                            [text] => SimpleXMLElement Object
                                ([t] => test comment 1)
                        )
                    [1] => SimpleXMLElement Object
                        (
                            [@attributes] => Array
                                (
                                    [authorId] => 0
                                    [ref] => G4
                                )
                            [text] => SimpleXMLElement Object
                                (
                                    [t] => test comment 2
                                )
                        )
                )
        )
) 

```

i want to read comments using ref values , i tried to read value of G2 like 

```
echo $value = (string) $comments->commentList->comment[0]->ref['G2'];

```

but no success , any idea how to read values through ref values like G2 , G4