Dom XML get_element_by_tag_name() question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
barry_normal
Forum Newbie
Posts: 21
Joined: Sun Jul 02, 2006 5:02 am

Dom XML get_element_by_tag_name() question

Post by barry_normal »

Hello there, just wondering if anyone can tell me whether when you copy <item> elements from and RSS feed using something like this:

Code: Select all

$doc = domxml_new_doc("1.0");
$doc = domxml_open_file('http://news.google.co.uk/nwshp?hl=en&tab=wn&q=&output=rss');

$item_array = $doc->get_elements_by_tagname("item");
Does this copy the whole tree so you can then do this:

Code: Select all

$title_array = $item_array->get_elements_by_tagname("title");
or is that incorrect and what I need to do is generate a new xml doc tree with the various <item>s?

It doesn't seem to work as I've got it above but I could be doing something else daft.

Any help would be much appreciated.

B
Post Reply