I'm stuck a little at this point. Let's say, we have this XML:
<object>
<data name="my name">Alex</data>
<data name="somebody's name">Dan</data>
</object>
In PHP, I can select value of the object by simplexml's XPath:
<?
$result = $xml->xpath('/object/data[@name="my name"]'); //array of values
echo $result[0]; //output: Alex
?>
But I can't get it: how can I do the same using javascript? I mean, is there any method like .getElementByTagName(), but for attribute's value?
Thank you.
No comments:
Post a Comment