This is my PHP/XML code. I just want to search the 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++;
}
Where should I put the $searchTerm
variable to search that particular node?