Background Information:
I am writing a program that parses a "question/answer" database composed of a XML file. I am using XMLReader to do my parsing. During the startElement function, if the tag is "question" then a new Question object will be pushed onto a stack. However, if it's a simple element just such as the answer then a StringBuffer will be pushed onto the stack. The characters method will append to the StringBuffer and then the SB will be applied to the attribute of the Question object. Lastly, the Question object will be added to an ArrayList. The code works great up until after the 'xr.parse(new InputSource(r));' statement is done parsing the document..
Sample XML file:
Using various debug out statements, the size of the ArrayList is intact throughout the endDocument(), startElement(), etc, methods. However, after the parsing is done, the array list's size is 0. I am completely stumped as to why this is happening. Here is the source:
And the Question object class:
Sorry for the such lengthy
thread, but I've tried every single option in the book and I can't find the bug. Please help me. Thank you.
[ June 12, 2006: Message edited by: Joe Budden ]
[ June 12, 2006: Message edited by: Joe Budden ]