W3C 验证程序发出警告:未找到 DOCTYPE!对于 Kohana 3 Feed Class

W3C validator given warning: No DOCTYPE found! for Kohana 3 Feed Class

我正在使用 Feed Class from Kohana 3.0 的以下代码来创建 rss 提要。

class Controller_Feed extends Controller {

    public function action_best()
    {
        $info = array(
           "title" => "HYIP Monitor,
           "pubDate" => date("D, d M Y H:i:s T"),
           "description" => "Provides the best style of HYIP Rating.",
           "link" => "http://tophyips.info/",
           "copyright" => "TOPHYIPS.INFO",
           "language" => "en-us",
           "ttl" => "5",
        );

        $items = array();   
        $items[1] = array(
           "title" => "Best Rated Hyips Style-1",
           "link" => "http://tophyips.info/monitor/hyip-rating/style-1/best-1",
           "description" => "Best Monitoring Site Style#1",
           "guid" => "http://tophyips.info/monitor/hyip-rating/style-1/best-1",
        );

        $this->response->headers('Content-Type', 'text/xml; charset=utf-8');
        $this->response->body(Feed::create($info, $items));
    }

}//End File

关于使用 W3C 验证,您可以检查此 link:http://validator.w3.org/ 给出的结果表明该文档已成功检查为格式正确 XML!但有以下警告:

No DOCTYPE found! Checking XML syntax only.

The DOCTYPE Declaration was not recognized or is missing. This probably means that the Formal Public Identifier contains a spelling error, or that the Declaration is not using correct syntax, or that your XML document is not using a DOCTYPE Declaration.

请告知如何解决此警告。我将使用什么样的 DOCTYPE 声明以及将代码放在 class Kohana_Feed 文件中的什么位置。谢谢。

W3C 的 Markup Validation Service 适用于 (X)HTML、MathML、SVG 和 SMIL 文档。

要验证提要,您应该使用 W3C 的 Feed Validation Service

这不会生成缺少 DOCTYPE 的警告,这在 XML 中不是必需的。