int main( int argc, char *argv[] ) {
	
	MusicCollection *library = MusicCollection::getInstance();
        iTunesXmlHandler *handler = new iTunesXmlHandler(library);

        QXmlSimpleReader reader;
        reader.setContentHandler(handler);
        reader.setErrorHandler(handler);

        //QFile file("../iTunes-training.xml");
        QFile file("../iTunesMusicLibrary-grid.xml");
        //QFile file("../iTunesMusicLibrary.xml");
        //QFile file("../iTunesMusicLibrary-small.xml");

        if ( file.open(QFile::ReadOnly | QFile::Text) ) {

                QXmlInputSource xmlSource(&file);
                if ( reader.parse(xmlSource) ) {

                        library->display();

                } else {
                        std::cout << "Error iTunes Parse Reader Error\n";
                }
        } else {
        	std::cout << "Error iTunes XML Library File Not Found\n";
        }

        delete handler;
        delete library;

	return 0;
}
Exemplo n.º 2
0
void SATDialog::readCategories(const QString& fileName)
{
	QFile file(fileName);
	CategoriesReader catReader;
	QXmlInputSource  xmlSource(&file);
	QXmlSimpleReader reader;
	reader.setContentHandler(&catReader);
	reader.parse(&xmlSource);
	QStringList& categories = catReader.categories;
	for (int i = 0; i < categories.count(); ++i)
	{
		QString category = categories.at(i);
		if (!category.isEmpty() && !cats.contains(category))
			cats.insert(category, category);
	}
}
Exemplo n.º 3
0
void JambiApiParser::parseSourceFile(const Location &location, const QString &filePath, Tree *tree)
{
    javaTre = tree;
    metJapiTag = false;

    QXmlSimpleReader reader;
    reader.setContentHandler(this);
    reader.setErrorHandler(this);

    QFile file(filePath);
    if (!file.open(QFile::ReadOnly)) {
        location.warning(tr("Cannot open JAPI file '%1'").arg(filePath));
        return;
    }

    japiLocation = Location(filePath);
    QXmlInputSource xmlSource(&file);
    reader.parse(xmlSource);
}