using php to check if xml is atom or rss

Posted by guest86 on Stack Overflow See other posts from Stack Overflow or by guest86
Published on 2011-01-03T16:47:39Z Indexed on 2011/01/03 16:53 UTC
Read the original article Hit count: 279

Filed under:
|
|
|
|

i'm writing a php code which has to determine if given xml is in "atom" or "rss" format. After observing atom and rss xml files, i decided classify xml based on a root element. If root element is "<feed" it's an atom xml. If it's "<rss" it's not an atom.

How can i perform that check using DOM? So far i have:

$dom->loadXML($resp);
$feed = $dom->getElementsByTagName("feed");

but it's not working quite right....

© Stack Overflow or respective owner

Related posts about php

Related posts about dom