开发者

How can i validate an XML feed before parsing it with simplexml_load_file in PHP?

I am doing this at the moment

<?php   

     $xml = si开发者_JAVA技巧mplexml_load_file('www.tompeters.com/atom.xml');                  
     print_r($xml);

?>

but it returns this error

Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "www.tompeters.com/atom.xml"

I think it is because the feed isn't valid XML? So how can I validate it so I can parse the feed?

Thanks


Parsing the feed is validating it.

Anyway, the error message looks more like that you don't have access to that file. I don't know PHP, but I would have expected at least

simplexml_load_file('http://www.tompeters.com/atom.xml');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜