I'm testing rss feed reader, from a sample. It uses:
$xmlDoc = new DOMDocument();
$xmlDoc->load($url);
$items = $xmlDoc->getElementsByTagName('item');
for ($i=0; $i < $items->length; $i++) {
$item_title = $items->item($i)->getElementsByTagName('title')->item(0)->childNodes->item(0)->nodeValue;
$item_link = $items->item($i)->getElementsByTagName('link')->item(0)->childNodes->item(0)->nodeValue;
$item_desc = $items->item($i)->getElementsByTagName('description')->item(0)->childNodes->item(0)->nodeValue;
}
When i check the XML, it has another Tags like:
- Date
- Image Link
How can i call these all other tags? Because i can't call myself.
For example, for the 'date', i can't use getElementsByTagName('date')
.
It showing error: Fatal error: Call to a member function item() on a non-object
- So, is there fixed names for tags?
- If so, what are these?
- (or) How can i know/ parse/ detact/ extract all available tags inside XML?