0

Possible Duplicate:
Parse XML with Namespace using SimpleXML

how do i get the attribute value of seconds from the XML code below:

<yt:duration seconds='12445'/>

is it possible to use simplexml.

Thank you

Community
  • 1
  • 1
rob
  • 35
  • 1
  • 8
  • Assuming your xml content in text.xml $file = 'test.xml'; $xmlstr = file_get_contents($file); $xml_content = new SimpleXMLElement($xmlstr); echo $xml_content->attributes()->seconds; – Muhammad Yasin Aug 04 '12 at 17:52
  • $string = << XML; $xml = simplexml_load_string($string); foreach($xml->attributes() as $a) { echo $a; } output:- 12445 – Abid Hussain Aug 04 '12 at 18:29

0 Answers0