void DTD::parseDTDElement(QString line) { QString name; QString *value; line.replace("\\end", " "); name = line.mid(10); int firstSpace = name.find(' '); name.remove(firstSpace, name.length()-firstSpace); value = new QString(line.mid(10+firstSpace)); //value->remove(0, value->find("\"")+1); value->remove(value->find(">"), 10000); parseDTDReplace(&name); parseDTDReplace(value); if ( name.startsWith("(") && name.endsWith(")") ) { name.remove(0,1); name.remove(name.length()-1,1); QStringList multipleTags = QStringList::split("|", name); QStringList::Iterator it = multipleTags.begin(); while(it != multipleTags.end()) { name = *it; name = name.stripWhiteSpace(); elements.insert(name, value); tags.append(name); //kdDebug() << "Element --- Name: " << name << " --- Value: " << *value << endl; ++it; } } else { elements.insert(name, value); tags.append(name); //kdDebug() << "Element --- Name: " << name << " --- Value: " << *value << endl; } }
void DTD::parseDTDEntity(QString line) { QString name; QString *value; line.replace("\\end", " "); name = line.mid(11); int firstSpace = name.find(' '); name = name.remove(firstSpace, name.length()-firstSpace); value = new QString(line.mid(11+firstSpace)); value->remove(0, value->find("\"")+1); value->remove(value->findRev("\""), value->length()); parseDTDReplace(value); stripSpaces(value); entities.insert(name, value); //kdDebug() << "Entity --- Name: " << name << " --- Value: " << *value << endl; }