This is my php/xml code. I just want to search that particular $searchterm from this :
$doc = new DOMDocument;
$doc->load('authentication.xml');
$xpath = new DOMXPath($doc);
$searchTerm = "N0A097016646";
$lineNo = 0;
foreach ($xpath->query('//device/following::comment()') as $comment){
$serial= $xpath->query('//device', $comment)->item($lineNo)->textContent;
echo "Line number: ".$comment->getLineNo()." Device number: ".$serial." Comented number: ".$comment->textContent."<br>";
$lineNo++;
}
To where I should put $searchTerm varible to search that particular node? Please help.
No comments:
Post a Comment