开发者

Parsing question?

I want to make a webpage that parses the weather channels XML file to display local weather, and replace images as to the current conditions and display the infor开发者_运维技巧mation on the webpage.

Would I use Javascript for this? Any idea on how to implement this?


It depends. If you want your user's browsers to request and load data directly from the weather channels, then yes javascript is what you need in order to make the appropriate AJAX requests and update the page contents. However bear in mind that you must check that you'll be able to make cross-domain requests to the weather channels. If their API supports JSON and specifically JSONP this will not be a problem.

On the other hand if you will not be able to make cross-domain requests and/or there will be processing you need to do server-side then javascript (apart from general interactivity you plan to include on your pages) is not what you need (unless you use node.js, I'm guessing unlikely). You can use whatever server-side language you like - php, python, c#, java probably being the most common. Your server will make calls to the weather channel APIs, process the xml, and spit out an HTML document whenever a user makes a request.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜