注意:尝试在LINE 44中获取非对象的属性

时间:2013-12-31 07:16:18

标签: php xml request response

我在行中遇到错误$ x = $ x-> firstChild-> textContent;显示没问题,但通知错误显示,如何摆脱这个通知错误?我刚刚从rss feed中获取了这段代码。我不确切知道发生了什么。

<?php

$Universal_Style = "p";   // replace that by span class="" to custom
$Universal_Date_Font = "size='-1'";

$Universal_FeedArray = array();

$Universal_AtomChannelTags = array("title","link","subTitle","updated");
$Universal_AtomItemTags = array("title","link","summary","pubDate");

$Universal_RssChannelTags = array("title","link","description","lastBuildDate");
$Universal_RssItemTags = array("title","link","description","pubDate");

$Universal_Translation = array("title"=>"title", 
  "link"=>"link",
  "description"=>"description",
  "subTitle"=>"description",
  "summary"=>"description",
  "lastBuildDate"=>"updated",
  "pubDate"=>"updated");

$Universal_Doc = false;


/**
 *  Read the content of a tag
 *  Input: 
 *  - element: the node
 *  - tag: the name of the tag
 *  Ouput:
 *  - the content
 */       

function getTag($element, $tag)
{
  $x = $element->getElementsByTagName($tag);
  if($x->length == 0)
  {
    return false;
  }  
  $x = $x->item(0);
  $x = $x->firstChild->textContent;
  return $x;
}

?>

0 个答案:

没有答案