如何解析名称中包含“ - ”的xml标签?

i can't parse the tags containing "-" in their name in php with simplexml.

this is the xml- http://synd.cricbuzz.com/score-gadget/gadget-scores-feed.xml

the url-text and url-link could not be parsed.following errors accoured- 1)Use of undefined constant text - assumed 'text' in C:\wamp\www\score1.php 2)Use of undefined constant link - assumed 'link' in C:\wamp\www\score1.php 3)2)Use of undefined constant link - assumed 'url' in C:\wamp\www\score1.php plz help me php is parsing the url-text as seprate variables-"url" and "text"

this is the code

<?php 
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Pragma: no-cache"); Header('Pragma: no-cache');

    $url = "http://synd.cricbuzz.com/score-gadget/gadget-scores-feed.xml";
    //$url = "C:\wamp\www\score.xml";
    $curl = curl_init();
    curl_setopt ($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

    $result = curl_exec ($curl);
    curl_close ($curl);
    print $result;
    $fp = fopen('score.xml', 'w');
    if($fp)
        fwrite($fp,  $result);  
    else
    echo "Error !";

    $url = "score.xml";
    $xml = simplexml_load_file($url,null, LIBXML_NOCDATA);
     foreach ($xml->match as $xmlinfo):
        $header=$xmlinfo->header;
        $description=$xmlinfo->description;
        $urltext=$xmlinfo->url-text;
        $urllink=$xmlinfo->url-link;
        echo $header,$description,$urltext;
    endforeach;
    //var_dump($xml);
 ?>

Accessing elements within an XML document that contain characters not permitted under PHP's naming convention (e.g. the hyphen) can be accomplished by encapsulating the element name within braces and the apostrophe.

In your case:

$xmlinfo->{'url-text'}

Live DEMO.

Source Example #3