Welcome! Log In Create A New Profile

Advanced

assignment 2 question 3

Posted by 33076960 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
assignment 2 question 3
July 07, 2010 01:13PM
hello,

I know most of you have already submitted assignment 2 and started with assignment 3. I got till tomorrow, which is 1 week after closing date still to submit electronically. A habit I'm trying to break, very difficult.

I'm battling with question 3 of assignment 2. For the life of me I just do not know where or how to start with this particular question. I've tried many ways. I know how to write to a QFile, but I cannot seem to read from a QFile. And because there is no output on the console, I'm not sure whether my program works or not.

Any help would be appreciated.

Ronica
avatar Re: assignment 2 question 3
July 07, 2010 01:16PM
If you send me a snippet of your code, I'll look over it for you and try to help out.
avatar Re: assignment 2 question 3
July 07, 2010 01:22PM
Actually, just looked at my code, you shouldn't need to read from the input file at all.
That seems to be handled internally by QXmlInputSource and QXmlSimpleReader.
Re: assignment 2 question 3
July 07, 2010 01:28PM
Ok, you know the program in the text book, whenever I run it, it doesn't do anything. I mean from what I gather, it supposed to write the xml code stuff into another file. But how is that other file created. That's what I don't get. I'm going on the assumption that the answer is not that different from that code in the textbook.
Re: assignment 2 question 3
July 07, 2010 02:11PM
Hi, maybe this will help...QXmlContentHandler and QXmlDefaulftHandler(Derived from QXmlContentHandler) are there to handle the information read from the source with read information passed as parameters to the functions of the handler, i.e qName in startElement function. The handler doesn't do anything, that is until you tell it to. In the text book, as far I can remember(don't have it infront of me), they make use of an QTextStream declared as a global variable to write the text using stdout. In my program I created my own file using QFile and wrote to it using QTextStream, by placing the code to open and close the file in startDocument and endDocument functions, which basically act like a Constructor and Destructor respectively by being called first and last. Go read up on the the classes I mentioned here(along with QXmlSimpleReader) in the Qt documentation, it might give you a clearer picture.
Re: assignment 2 question 3
July 07, 2010 02:19PM
Thanks ME, will do that, and Brett.
Sorry, only registered users may post in this forum.

Click here to login