bool endDocument() { while ( stack.count() > 1 ) stack.pop(); // The parent node should take care of deleting the children if ( stack.count() == 1 ) delete stack.pop(); return true; }
bool startElement( const QString& /*namespaceURI*/, const QString& localName, const QString& qName, const QXmlAttributes& atts ) { // Some Parent Elements have special meanings if ( stack.isEmpty() ) { if ( qName == "definitions" ) return true; // Include another file if ( qName == "include" ) { QString value = atts.value( "file" ); impl->imports.push_back( value ); return true; } } cElement* element = new cElement; element->setName( localName.latin1() ); element->copyAttributes( atts ); // Child Element ? if ( stack.count() > 0 ) { cElement* parent = stack.current(); // Pop the potential parent parent->addChild( element ); // Add the child to it's parent element->setParent( parent ); } stack.push( element ); // Push our element (there may be children) return true; }