2
XML文件:DOMXPath - 查詢
<Domain Domaindetails="This tree display the domain we work">Root element
<Insurance>
<InsuranceQ>
<Devs>4</Devs>
<QA>1</QA>
<Total>5</Total>
</InsuranceQ>
<?billResource bill()?>
<QuoteX/>
<ProgressiveLeads>
<Devs>3</Devs>
<Total>6</Total>
<QA>3</QA>
</ProgressiveLeads>
</Insurance>
<BI>
<MoboM/>
<CloudFW>
<Devs>4</Devs>
<QA>4</QA>
<Total>8</Total>
</CloudFW>
<?billResource bill()?>
</BI>
<Ecommerce>
<USEcom/>
<LXEcom/>
</Ecommerce>
<extrainfo>Co > S&S </extrainfo>
</Domain>
遍歷下保險領域的項目,因此寫了下面的代碼
$dom = new DOMDocument('1.0');
$dom->load('project.xml');
$xpath = new DOMXPath($dom);
$nodeList=$xpath->query('//Domain/Insurance');
foreach($nodeList as $node)
{
echo $node->nodeValue;
echo '<br/>';
}
它顯示空的結果。我的XML有什麼問題嗎?上面的代碼導致415 [devs,qa,total nodes]不是預期的輸出。
我想舉報 InsuranceQ QuoteX Progressivelead as output。
有人可以讓我知道我做錯了......
感謝, Priti
不,它沒有幫助我...它仍然顯示我415 – user269867 2011-05-17 04:49:58