使用文件获取内容读取xml

i hv a xml file,how to get values in title field using get file content method..i just want to get the value "TomTom XXL 550M - US, Canada & Mexico Automotive GPS. (Brand New)"

<Title>
TomTom XXL 550M - US, Canada & Mexico Automotive GPS. (Brand New)
</Title>

my code

$xmlstr = file_get_contents($source);
$parseXML = new SimpleXMLElement($xmlstr);
print($parseXML);

// load as file
$parseXMLFile = new SimpleXMLElement($source,null,true);

If you feel confortable with javascript, there is another solution called DOMDocument

You can load XML files and also use function like getElementsByTagName. For example, if you have a books.xml file like this:

<?xml version="1.0" encoding="utf-8"?>
<books>
 <book><title>Patterns of Enterprise Application Architecture</title></book>
 <book><title>Design Patterns: Elements of Reusable Software Design</title></book>
 <book><title>Clean Code</title></book>
</books>

You can extract titles so:

$dom = new DOMDocument;
$dom->load('books.xml');
$books = $dom->getElementsByTagName('title');
foreach ($books as $book) {
    echo $book->nodeValue.'<br>';
}

You just have to read your file with simplexml_load_file : Doc for this one

You will then get object of class SimpleXMLElement.

Then, you can use it to get what you want ! Some examples here : SimpleXML Examples