我有我的xpath查詢使用simpleXML,我想用它來獲取標記標題,描述和鏈接的節點值。但我不知道如何輸出它們,比如只輸出標題內容。xpath simplexml標記查詢以及如何獲取節點值
<item>
<title>Cell Phone Plans That Make You Go Hmmm</title>
<link>http://www.articlegeek.com/computers/telecommunication_articles/10574- cellphoneplanst.htm</link>
<description>Cell phone plans across the globe vary a great deal. Some say that cell phone plans in the US are more costly. However, there are some advantages to the cell phone plans in the US which may balance the difference.</description>
</item>
function xmlXpath()
{
$xml = xmlParse();
$userIN = "cell";
$nodesT = $xml->xpath("
//*
[
text()
[
contains(
translate(.,'ABCDEFGHJIKLMNOPQRSTUVWXYZ',
'abcdefghjiklmnopqrstuvwxyz'),
'".$userIN."'
)
]
]
");
return $nodesT;
}
請發表您的XML代碼在你的問題,而不是鏈接。 – michi 2013-05-01 21:41:35