This is my XML file, and i want to know how to get the ID of the article when you know what the title is. Is this possible using Xpath?
XML dosyası:
<Articles>
<Article ID="1">
<title>test</title>
<content>test</content>
</Article>
</Articles>
Php kodu:
$dom = new DOMDocument;
$dom->load("Articles.xml");
$xp = new DOMXPath($dom);
$id = $xp->evaluate('string(/Articles/Article[title="test"]/@ID)');
var_dump($id);
Saygılarımızla,
Kullanıcı.