pbvamsi Posted January 27, 2012 Share Posted January 27, 2012 My XML file looks like <entry> some tags <title type='text'> content to be extracted </title> <content type='text'> content to be extracted </content> </entry> (there will be 3-4 titles and descriptions in each entry tag, bt i want only whose type is text) i used $dom = new DOMDocument(); libxml_use_internal_errors(true); $dom->loadXML("kFeed.xml"); $entryTag = $dom->getElementsByTagName("entry")->item(0); $title = $entryTag->getElementsByTagName("title")->item(0)->nodeValue; $descr = $entryTag->getElementsByTagName("content")->item(0)->nodeValue; the error i get is Fatal error: Call to a member function getElementsByTagName() on a non-object can someone help me to fix this problem. thanks Link to comment https://forums.phpfreaks.com/topic/255867-get-tag-value-from-xml-using-php/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.