I have a simpleXMLelement and the element objects in the array have the attribute [type]. This distinguishes them from each other. How would i go about parsing the objects that just have the attribute type set to [type] => release and displaying the summary section of that object.

below is an simpleXMLelement object code as an example

[6] => SimpleXMLElement Object
                    (
                        [@attributes] => Array
                            (
                                [num] => 7
                                [type] => master
                            )

                        [title] => DJ Tiësto - Sparkles
                        [uri] => [url]http://www.discogs.com/DJ-Tiësto-Sparkles/master/4001[/url]
                        [summary] => DJ Tiësto Sparkles Electronic Trance 1999  Sparkles (Airscape Remix) Sparkles (Original) Sparkles
                    )

and this is the PHP that creates the element -

$xmlmusic = new SimpleXMLElement($result);

Thanks guys.
DIM3NSION

    4 days later

    Try something like:

    $objects = $xmlmusic->xpath('/path/to/elements');
    foreach($object as $element)
    {
    if($element->attributes()->type == "release")
    {
    echo $element->summary;
    }

    }

      Write a Reply...