parsin XML with DOM
| From: | pobox@verysmall.org | Date: | Tue, 26 Jun 2007 08:43:22 +0000 |
| Subject: | parsin XML with DOM | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-257772@lists.php.net to get a copy of this message | ||
hello,
could somebody give me some direction here.
i am trying to build a RSS 2.0 parser using DOM. what puzzles me is the following -
i get the XML -
$RSS_XML = file_get_contents($params['uri']);
then i instantiate a DOM object -
$RSS_DOM = new DomDocument();
then i load the XML -
$RSS_DOM->loadXML($RSS_XML);
then i get the first node -
$NODE = $RSS_DOM->firstChild;
here $NODE->tagName is "rss", so far OK
but then if i get the first child of "rss", which is "channel" -
$NODE = $NODE->firstChild;
its type is not DomNode, but DomText.
Only the 2nd child -
$NODE = $NODE->nextSibling;
has $NODE->tagName "channel".
My question is - why is the first child after "rss" DomText?
Thank you,
Iv