LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-29-2008, 04:29 PM   #1
rowancompsciguy
Member
 
Registered: Sep 2006
Location: Cherry Hill, NJ
Distribution: Fedora Core 6
Posts: 42

Rep: Reputation: 15
Angry Reading XML with QT


I'm trying to write a function using QT to read in data from the Yahoo! weather feed so that I can parse it and put the data in a widget. I can't seem to get the data to come over though. Does anyone see anything wrong with my code? It compiles fine. I'm new to QT however and I would really appreciate some pointers.

Code:
char* Plasma_Weather::collectData()
{
   QHttp* http = new QHttp();
   QBuffer* buffer = new QBuffer();
   QUrl url("http://weather.yahooapis.com/forecastrss?p=08002");

   buffer->open(QBuffer::ReadWrite);

   http->setHost(url.host());
   http->get(url.path(), buffer);
   http->closeConnection();

   QByteArray array = buffer->readAll();

   delete http;
   delete buffer;

   return array.data();
}
 
Old 06-30-2008, 04:39 PM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
You might want to change the title to something like "downloading from URL with QT" - the current title suggests you are trying to parse XML, which doesn't actually appear to be the problem (not until you get the data anyhow).

A good place to start is the QT examples. Here's one with simple downloading in it:

http://doc.trolltech.com/4.4/network-http.html
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Processing XML file (reading records) lourencojunior Linux - Newbie 2 06-28-2008 01:20 PM
Reading/Wirting file/parsing xml file using javascript fakhrul Programming 1 08-14-2007 05:08 PM
configure: error: could not find DocBook XML DTD V4.1.2 in XML catalog Fadoksi Linux - Software 1 07-16-2006 06:41 AM
reading xml Armon Programming 2 01-12-2006 11:29 PM
Reading a xml document: amirspl Programming 3 09-10-2003 07:51 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration