示例#1
0
    /*
     *  (non-Javadoc)
     * @see org.xml.sax.ContentHandler#endElement(java.lang.string, java.lang.string, java.lang.string)
     */
    public override void endElement(string namespaceURI, string sName, string qName)
    {
        // Stores the title
        if (qName.Equals("title"))
        {
            if (reading == READING_NONE)
            {
                gameDescriptor.setTitle(currentstring.ToString().Trim());
            }
            else if (reading == READING_CHAPTER)
            {
                currentChapter.setTitle(currentstring.ToString().Trim());
            }
        }

        // Stores the description
        else if (qName.Equals("description"))
        {
            if (reading == READING_NONE)
            {
                gameDescriptor.setDescription(currentstring.ToString().Trim());
            }
            else if (reading == READING_CHAPTER)
            {
                currentChapter.setDescription(currentstring.ToString().Trim());
            }
        }

        // Change the state if ends reading a chapter
        else if (qName.Equals("chapter"))
        {
            // Add the new chapter and change the state
            gameDescriptor.addChapterSummary(currentChapter);
            reading = READING_NONE;
        }

        // Reset the current string
        currentstring = string.Empty;
    }