Xpath problem, i have a question about if i can get a elements attribute, if i know what a elements value is.

Posted by user577823 on Stack Overflow See other posts from Stack Overflow or by user577823
Published on 2011-01-16T21:50:13Z Indexed on 2011/01/16 21:53 UTC
Read the original article Hit count: 194

Filed under:
|
|

Hi guys,

This is the xml file, And my question is, is it possible to get the Article ID, when you have the title of the article?(via xpath)

`

crack jack `

Because i am using this right now, it isnt working though.

$xml = simplexml_load_file("Articles.xml");
$XElement = new SimpleXMLElement($xml->asXML());

$Articles = $XElement->xpath("Article");  

$title = "crack";

$elements = count($Articles);

for($i = 0; $i title;

 if($Titles == $title) //This is not working? i dont know why?
 {
  $AID = (string)$Articles[$i][@"ID"];
 }
}

Kind regards,

User577823

© Stack Overflow or respective owner

Related posts about php

Related posts about xpath