您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ xmlFile函数代码示例

51自学网 2021-06-03 10:22:51
  C++
这篇教程C++ xmlFile函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中xmlFile函数的典型用法代码示例。如果您正苦于以下问题:C++ xmlFile函数的具体用法?C++ xmlFile怎么用?C++ xmlFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了xmlFile函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: xmlFile

bool ValueAnimation::Save(Serializer& dest) const{    XMLFile xmlFile(context_);    XMLElement rootElem = xmlFile.CreateRoot("valueanimation");    if (!SaveXML(rootElem))        return false;    return xmlFile.Save(dest);}
开发者ID:FeodorFitsner,项目名称:Urho3D,代码行数:10,


示例2: xmlFile

bool MatrixGraph::readXml(const char* path){	char* data = nullptr;	xml_document<> doc;	try	{		file<> xmlFile(path);		data = new char[xmlFile.size()];		memcpy(data, xmlFile.data(), xmlFile.size() * sizeof(char));	}	catch (runtime_error e)	{		cout << "Nie mozna otworzyc pliku: " << path << endl;		if (data)			delete[] data;		cin.get();		cin.ignore();		return false;	}	bool retVal = false;	doc.parse<0>(data);	xml_node<>* node = doc.first_node("travellingSalesmanProblemInstance");	if (node)	{		node = node->first_node("graph");		if (node)		{			uint vNum = count_children(node);			reserve(vNum);			node = node->first_node("vertex");			for (uint vertex = 0; node != nullptr; node = node->next_sibling("vertex"), ++vertex)			{				xml_node<>* edge = node->first_node("edge");				for (; edge != nullptr; edge = edge->next_sibling("edge"))				{					matrix[vertex][atoi(edge->value())] = int(atof(edge->first_attribute("cost")->value()));					retVal = true;				}			}			for (uint i = 0; i < vertexNumber; i++)			{				matrix[i][i] = -1;			}		}	}	if (data)		delete[] data;	return retVal;}
开发者ID:iceslab,项目名称:PEA_PROJEKT,代码行数:55,


示例3: xmlFile

Monster* MonsterFactory::parseXmlMonster(char* monsterPath){	rapidxml::file<> xmlFile(monsterPath);	rapidxml::xml_document<> doc;	doc.parse<0>(xmlFile.data());	std::string xmlRootNodeName = std::string(doc.first_node()->name());	rapidxml::xml_node<> *rootNode = doc.first_node();	Monster* parsedMonster = NULL;	if (xmlRootNodeName == MONSTERS_ROOT_NODE)	{		MonsterType type = this->findMonsterType(rootNode->first_node());		if (type == MonsterType::BASIC)		{			BasicMonster* basicMonster = new BasicMonster();			this->fillBasicMonsterAttributes(basicMonster, rootNode->first_node());			this->fillGenericMonsterAttributes(basicMonster, rootNode->first_node());			parsedMonster = basicMonster;		}		else if (type == MonsterType::GENERIC)		{			Monster* genericMonster = new Monster();			this->fillGenericMonsterAttributes(genericMonster, rootNode->first_node());			parsedMonster = genericMonster;		}		else if (type == MonsterType::TURRET)		{			TurretMonster* turretMonster = new TurretMonster();			this->fillTurretMonsterAttributes(turretMonster, rootNode->first_node());			this->fillGenericMonsterAttributes(turretMonster, rootNode->first_node());			parsedMonster = turretMonster;		}		else if (type == MonsterType::DISTANCE)		{			DistanceMonster* distanceMonster = new DistanceMonster();			this->fillDistanceMonsterAttributes(distanceMonster, rootNode->first_node());			this->fillTurretMonsterAttributes(distanceMonster, rootNode->first_node());			this->fillBasicMonsterAttributes(distanceMonster, rootNode->first_node());			this->fillGenericMonsterAttributes(distanceMonster, rootNode->first_node());			parsedMonster = distanceMonster;		}		else if (type == MonsterType::BOMBER)		{			BomberMonster* bomberMonster = new BomberMonster();			this->fillBomberMonsterAttributes(bomberMonster, rootNode->first_node());			this->fillBasicMonsterAttributes(bomberMonster, rootNode->first_node());			this->fillGenericMonsterAttributes(bomberMonster, rootNode->first_node());			parsedMonster = bomberMonster;		}	}	return parsedMonster;}
开发者ID:felipeek,项目名称:Linked,代码行数:55,


示例4: xmlFile

//read data from xml fileTeam* TeamData::readTeamData(QString filename){   QFile xmlFile(filename);   QXmlInputSource source(xmlFile);   QXmlSimpleReader reader;   TeamParser *handler = new TeamParser();   reader.setContentHandler(handler);   reader.parse(source);   return(handler->teamData());}
开发者ID:edlau,项目名称:GABot,代码行数:12,


示例5: TEUCHOS_UNIT_TEST

 TEUCHOS_UNIT_TEST( XMLParameterListReader, XMLDuplicatedSublistsThrowsError ) {   FileInputSource xmlFile(filename);   XMLObject xmlParams = xmlFile.getObject();   XMLParameterListReader xmlPLReader;   TEST_EQUALITY_CONST( xmlPLReader.getAllowsDuplicateSublists(), true );   out << "Changing policy to disallow duplicate sublists" << std::endl;   xmlPLReader.setAllowsDuplicateSublists( false );   TEST_EQUALITY_CONST( xmlPLReader.getAllowsDuplicateSublists(), false );   TEST_THROW( xmlPLReader.toParameterList(xmlParams), DuplicateParameterSublist ); }
开发者ID:OpenModelica,项目名称:OMCompiler-3rdParty,代码行数:11,


示例6: xmlFile

//// Set up the XML file for reading, then start the parse. The XML parse// proceeds and calls the callback functions below. Return false if the// parser detected an error.//bool CDCConfig::ReadConfigFile(wchar_t *configFileName){	// Create a file, an XML input source and a simple reader	QFile xmlFile( QString::fromUcs2((const short unsigned int*)configFileName) ) ;	QXmlInputSource source( xmlFile ) ;	QXmlSimpleReader reader ;	// Connect this object's handler interface to the XML reader	reader.setContentHandler( this ) ;	// Return true if the parse succeeds and no XML semantic errors	return( reader.parse( source ) && (!m_xmlSemanticError) ) ;}
开发者ID:concocon,项目名称:CodeAnalyst-3_4_18_0413-Public,代码行数:16,


示例7: xmlFile

void Remote::loadFromFile(const QString &fileName){	charBuffer = "";	curRB = 0;	QFile xmlFile(fileName);	QXmlInputSource source(&xmlFile);	QXmlSimpleReader reader;	reader.setContentHandler(this);	reader.parse(source);}
开发者ID:serghei,项目名称:kde3-kdeutils,代码行数:11,


示例8: xmlFile

bool CompoundHandler::parseXML(const char *compId){  QFile xmlFile(m_xmlDir+"/"+compId+".xml");  if (!xmlFile.exists()) return FALSE;  CompoundErrorHandler errorHandler;  QXmlInputSource source( xmlFile );  QXmlSimpleReader reader;  reader.setContentHandler( this );  reader.setErrorHandler( &errorHandler );  reader.parse( source );  return TRUE;}
开发者ID:tch-opensrc,项目名称:TC72XX_LxG1.7.1mp1_OpenSrc,代码行数:12,


示例9: QAction

void KMibwalker::setupActions() {    QAction* clearAction = new QAction ( this );    clearAction->setText ( i18n ( "&Clear" ) );    clearAction->setIcon ( QIcon::fromTheme ( "document-new" ) );    actionCollection()->setDefaultShortcut ( clearAction, Qt::CTRL + Qt::Key_W );    actionCollection()->addAction ( "clear", clearAction );    //connect ( clearAction, SIGNAL ( triggered ( bool ) ), textArea, SLOT ( clear() ) );    KStandardAction::quit ( qApp, SLOT ( quit() ), actionCollection() );    setupGUI ( Default, "kmibwalkerui.rc" );    qDebug() << "xml file: " << xmlFile();}
开发者ID:prplmnky,项目名称:kmibwalker,代码行数:12,


示例10: xmlFile

void MainWindow::on_itemListSave_clicked(){    QFile xmlFile(ui->lineEditItemFile->text());    if(!xmlFile.open(QIODevice::WriteOnly))    {        QMessageBox::warning(this,tr("Error"),tr("Unable to open the file %1:/n%2").arg(xmlFile.fileName()).arg(xmlFile.errorString()));        return;    }    xmlFile.write(domDocument.toByteArray(4));    xmlFile.close();    QMessageBox::information(this,tr("Saved"),tr("The file have been correctly saved"));}
开发者ID:chiefexb,项目名称:CatchChallenger,代码行数:12,


示例11: xmlFile

bool XMLWriter::saveToFile(QString fileName){    if ((m_doc->childNodes().count()==0)||fileName.isEmpty()) return false;    QFile xmlFile(fileName);    if (xmlFile.open(QFile::WriteOnly)) {        QTextStream buffer(&xmlFile);        m_doc->save(buffer,2);        xmlFile.close();        return true;    }    return false;}
开发者ID:PepaRokos,项目名称:LimeReport,代码行数:12,


示例12: xmlFile

void QtSEnaMainWindow::apri() {    QFile xmlFile(_apriFile->selectedFiles().at(0));    if(xmlFile.open(QIODevice::ReadOnly)) {        QXmlStreamReader xmlStream(&xmlFile);        while(!xmlStream.atEnd()) {            xmlStream.readNext();            if(xmlStream.isStartElement() && xmlStream.name().toAscii() == "Elementi") {                QStringList sElementi = QString(xmlStream.readElementText().toAscii()).split(QChar(','));                _grigliaNumeri->deselezionaTutti();                for (quint8 i = 0; i < sElementi.count(); i++) {                    _grigliaNumeri->selezionaValore(sElementi.at(i).toUShort() - 1);                }            }            if(xmlStream.isStartElement() && xmlStream.name().toAscii() == "Somma") {                ui->maxSum->setValue(xmlStream.attributes().value("max").toAscii().toInt());                ui->minSum->setValue(xmlStream.attributes().value("min").toAscii().toInt());            }            if(xmlStream.isStartElement() && xmlStream.name().toAscii() == "Consecutivi") {                QStringList sConsecutivi = QString(xmlStream.readElementText().toAscii()).split(QChar(','));                for (quint8 i = 0; i <= _NUMERO_ELEMENTI_COLONNA; i++)                    _consecutivi.at(i)->setChecked(false);                for (quint8 i = 0; i < sConsecutivi.count(); i++) {                    _consecutivi.at(sConsecutivi.at(i).toUShort())->setChecked(true);                }            }            if(xmlStream.isStartElement() && xmlStream.name().toAscii() == "Gemelli") {                QStringList sGemelli = QString(xmlStream.readElementText().toAscii()).split(QChar(','));                for (quint8 i = 0; i <= _NUMERO_ELEMENTI_COLONNA; i++)                    _gemelli.at(i)->setChecked(false);                for (quint8 i = 0; i < sGemelli.count(); i++) {                    _gemelli.at(sGemelli.at(i).toUShort())->setChecked(true);                }            }            if(xmlStream.isStartElement() && xmlStream.name().toAscii() == "Pari") {                QStringList sPari = QString(xmlStream.readElementText().toAscii()).split(QChar(','));                for (quint8 i = 0; i <= _NUMERO_ELEMENTI_COLONNA; i++)                    _pari.at(i)->setChecked(false);                for (quint8 i = 0; i < sPari.count(); i++) {                    _pari.at(sPari.at(i).toUShort())->setChecked(true);                }            }        }        xmlFile.close();#ifdef _DEBUG_FLAG_ENABLED        if (xmlStream.hasError()){            qWarning() << "[QTSENAMAINWINDOW] - on_actionApri_triggered() - Errore: " << xmlStream.errorString();        }    } else {        qWarning() << "[QTSENAMAINWINDOW] - on_actionApri_triggered() - Impossibile leggere dal file " << _nomeFile;#endif //_DEBUG_FLAG_ENABLED    }}
开发者ID:sarace77,项目名称:QtSEna,代码行数:52,


示例13: PropertyParser

bool PropertyDict::readXmlFile( const QString &fileName ){    PropertyParser *handler = new PropertyParser( this, fileName );    checkmem( __FILE__, __LINE__, handler, "PropertyParser handler", 1 );    QFile xmlFile( fileName );    QXmlInputSource source( &xmlFile );    QXmlSimpleReader reader;    reader.setContentHandler( handler );    reader.setErrorHandler( handler );    bool result = reader.parse( &source );    delete handler;    return( result );}
开发者ID:cbevins,项目名称:BehavePlus5,代码行数:13,


示例14: xmlFile

void XmlStore::load( Object * _obj ){    QDomDocument doc;    QFile xmlFile( m_file.isEmpty() ? configurationFilePath() : m_file );    if( !xmlFile.open( QFile::ReadOnly ) || !doc.setContent( &xmlFile ) )    {        qWarning() << "Could not open" << xmlFile.fileName();        return;    }    QDomElement root = doc.documentElement();    loadXmlTree( _obj, root, QString() );}
开发者ID:EmebedQtsoft,项目名称:italc2,代码行数:13,


示例15: throw

void ReviewedTestSerializator::saveTest(const ReviewedTest &test, const QString &filename) throw (Exception){    QFile xmlFile(filename);    if (!xmlFile.open(QIODevice::WriteOnly))    {        throw Exception(Exception::FileOperationError, QString("Couldn't open file - " + filename));    }    xmlFile.write(getTestXML(test).toByteArray());    xmlFile.close();}
开发者ID:EPecherkin,项目名称:Exams_v2,代码行数:13,


示例16: xmlFile

bool ConvertXml::load(QString fileName){	MusicXMLErrorHandler errHndlr;	QFile xmlFile(fileName);	QXmlInputSource source(&xmlFile);	QXmlSimpleReader reader;	reader.setContentHandler(this);	reader.setErrorHandler(&errHndlr);	errHndlr.setParser(this);	reader.parse(source);    return TRUE;}
开发者ID:pavelliavonau,项目名称:kguitar,代码行数:13,


示例17: xmlFile

//// EventsFile::Open()// Open XML file and set up handler to parse the XML file//bool//EventsFile::Open(const wchar_t *events_file_path )EventsFile::Open(QString strEventsFile){    QFile xmlFile(strEventsFile);    QXmlInputSource source(&xmlFile);    QXmlSimpleReader reader;    /* set our xml handler to do work on the data */    reader.setContentHandler(this);    return reader.parse(source);}
开发者ID:CSRedRat,项目名称:CodeXL,代码行数:17,


示例18: xmlFile

std::auto_ptr<Project> ProjectFileParser::Parse(std::string file){    std::auto_ptr<Project> ret;    try    {        rapidxml::file<> xmlFile(file.c_str());        rapidxml::xml_document<> doc;        doc.parse<0>(xmlFile.data());        rapidxml::xml_node<>* projNode = doc.first_node();        if (projNode == NULL) return ret;        if (std::string(projNode->name()) != "Project") return ret;        ret.reset(new Project());        m_project = ret.get();        rapidxml::xml_node<>* node = projNode->first_node();        while (node)        {            switch (GetNodeType(node))            {                case eItemGroup:                    ReadItemGroup(node);                    break;                case ePropertyGroup:                    ReadPropertyGroup(node);                    break;                case eImportGroup:                    ReadImportGroup(node);                    break;                case eImport:                    ReadImport(node);                    break;                case eItemDefinitionGroup:                    ReadItemDefinitionGroup(node);                    break;                case eUnknown:                    break;                default:                    // any node at this level should be handled                    break;            }            node = node->next_sibling();        }    }    catch (...)    {        ret.reset();    }    m_project = NULL;    return ret;}
开发者ID:adhdengineering,项目名称:Linux,代码行数:51,


示例19: setupStandardActions

void ImageWindow::setupActions(){    setupStandardActions();    // Provides a menu entry that allows showing/hiding the toolbar(s)    setStandardToolBarMenuEnabled(true);    // Provides a menu entry that allows showing/hiding the statusbar    createStandardStatusBarAction();    d->toMainWindowAction = new KAction(KIcon("view-list-icons"),                                        i18nc("@action Finish editing, close editor, back to main window", "Close Editor"), this);    connect(d->toMainWindowAction, SIGNAL(triggered()), this, SLOT(slotToMainWindow()));    actionCollection()->addAction("imageview_tomainwindow", d->toMainWindowAction);    // -- Special Delete actions ---------------------------------------------------------------    // Pop up dialog to ask user whether to permanently delete    d->fileDeletePermanentlyAction = new KAction(KIcon("edit-delete"), i18n("Delete File Permanently"), this);    d->fileDeletePermanentlyAction->setShortcut(KShortcut(Qt::SHIFT+Qt::Key_Delete));    connect(d->fileDeletePermanentlyAction, SIGNAL(triggered()),            this, SLOT(slotDeleteCurrentItemPermanently()));    actionCollection()->addAction("image_delete_permanently", d->fileDeletePermanentlyAction);    // These two actions are hidden, no menu entry, no toolbar entry, no shortcut.    // Power users may add them.    d->fileDeletePermanentlyDirectlyAction = new KAction(KIcon("edit-delete"),            i18n("Delete Permanently without Confirmation"), this);    connect(d->fileDeletePermanentlyDirectlyAction, SIGNAL(triggered()),            this, SLOT(slotDeleteCurrentItemPermanentlyDirectly()));    actionCollection()->addAction("image_delete_permanently_directly",                                  d->fileDeletePermanentlyDirectlyAction);    d->fileTrashDirectlyAction = new KAction(KIcon("user-trash"),            i18n("Move to Trash without Confirmation"), this);    connect(d->fileTrashDirectlyAction, SIGNAL(triggered()),            this, SLOT(slotTrashCurrentItemDirectly()));    actionCollection()->addAction("image_trash_directly", d->fileTrashDirectlyAction);    // ---------------------------------------------------------------------------------    d->dbStatAction = new KAction(KIcon("network-server-database"), i18n("Database Statistics"), this);    connect(d->dbStatAction, SIGNAL(triggered()), this, SLOT(slotDBStat()));    actionCollection()->addAction("editorwindow_dbstat", d->dbStatAction);    // ---------------------------------------------------------------------------------    createGUI(xmlFile());}
开发者ID:UIKit0,项目名称:digikam,代码行数:51,


示例20: QWidget

TypeDescription::TypeDescription(QString type, QWidget *parent) :    QWidget(parent), type(type){    QFile xmlFile(":/MBTI.xml");    if (!xmlFile.open(QIODevice::ReadOnly)) {        QMessageBox::critical(this, tr("Impossible d'ouvrir le fichier XML"), tr("Impossible d'ouvrir le fichier XML MBTI.xml"));        return;    }    QDomDocument xml;    if (!xml.setContent(&xmlFile)) {        xmlFile.close();        QMessageBox::critical(this, tr("Fichier XML invalide"), tr("Le fichier MBTI.xml n'est pas un fichier XML valide"));        return;    }    xmlFile.close();    QVBoxLayout *mainLayout = new QVBoxLayout;    mainLayout->setSpacing(0);    mainLayout->setMargin(5);    setLayout(mainLayout);    //we can't use directly QDomNode description = new QDomNode(xml.elementById(type.toLower())) because elementById return always null    //Because that don't work currently :    //"Since the QDomClasses do not know which attributes are element IDs, this function returns always a null element.    //This may change in a future version."    QDomNodeList *descriptions = new QDomNodeList(xml.elementsByTagName("description"));    QDomNode description;    for (int i = 0; i < descriptions->size(); i++) {        QDomNode candidate = descriptions->at(i);        if (candidate.attributes().namedItem("id").nodeValue() == type.toLower()) {            description = candidate;            break;        }    }    if (description.isNull()) {        QLabel *errorText = new QLabel(tr("Il n'y a pas de description disponible pour le type : <strong>%1</strong>").arg(type));        mainLayout->addWidget(errorText);        return;    }    QPushButton *typeButton = new QPushButton(type);    mainLayout->addWidget(typeButton);    connect(typeButton, SIGNAL(clicked()), this, SLOT(openWikipedia()));    QTextEdit *descriptionText = new QTextEdit;    descriptionText->setReadOnly(true);    descriptionText->setPlainText(description.firstChild().nodeValue());    mainLayout->addWidget(descriptionText);}
开发者ID:Giorgiolino,项目名称:MBTI,代码行数:50,


示例21: xmlFile

void COptionTreeWrapper::Init(const StdString &fileName){	StdString xmlFile( m_szBasePath );		xmlFile += fileName;	if (!m_ControlSchema.ReadXML(xmlFile))	{		std::string szText; 		szText = "Failed to load xml format file: "; 		szText += fileName; 		::MessageBox(NULL, szText.c_str(), "Warning!", MB_OK|MB_ICONEXCLAMATION);	}}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:14,


示例22: while

void ConfigFile::parseDescriptionFiles(){  bool okay = false;  while (!okay) {    delete generator_;    generator_ = new Miro::CFG::Generator;    delete handler_;    handler_ = new Miro::CFG::Parser(*generator_);        QStringList::Iterator first, last = descriptionFiles_.end();    for (first = descriptionFiles_.begin(); first != last ; ++first) {      // kill previous namespace nesting      generator_->clearNamespace();      QString fileName = *first;      QFile xmlFile( fileName );      if (!xmlFile.exists()) {      QString infoText("Error parsing behaviour description file: /n" +		       fileName + "/n" +		       "File not found.");      QMessageBox::information(0, "Policy Editor", infoText);      descriptionFiles_.remove(first);      break;      }      QXmlInputSource source( xmlFile );      QXmlSimpleReader reader;      Miro::CFG::TextErrorHandler errorHandler;            reader.setContentHandler( handler_ );      reader.setErrorHandler( &errorHandler);      if (!reader.parse( source )) {	QString infoText("Error parsing behaviour description file:/n" +			 fileName + "/n" +			 errorHandler.errorString());	QMessageBox::information(0, "Policy Editor", infoText);	descriptionFiles_.remove(first);	break;      }    }    // parsing successfull    okay = true;    //    cout << "parsing complete. known types: " << endl;    //    cout << *generator_ << endl;  }}
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:49,


示例23: xmlFile

void DiskCache::loadLocallyOrRemotely(QString localFileName, QUrl remoteUrl, std::function<void(QString)> load, int numberOfDaysBeforeDownloadingAgain){    QFile xmlFile(localFileName);    if(!xmlFile.exists() || (numberOfDaysBeforeDownloadingAgain!=-1 && QFileInfo(xmlFile).lastModified().daysTo(QDateTime::currentDateTime())>=numberOfDaysBeforeDownloadingAgain))    {        xmlFile.close();        QNetworkReply* reply=mNetworkAccessManager->get(QNetworkRequest(remoteUrl));        connect(reply, &QNetworkReply::finished,[localFileName,load,reply](){            QString xmlContent=reply->readAll();            QFile xmlFile(localFileName);            xmlFile.open(QIODevice::WriteOnly|QIODevice::Text);            QTextStream out(&xmlFile);            out <<xmlContent;            xmlFile.close();            load(xmlContent);        });    }    else    {        xmlFile.open(QIODevice::ReadOnly|QIODevice::Text);        load(xmlFile.readAll());        xmlFile.close();    }}
开发者ID:rom1504,项目名称:TvSeriesAPI,代码行数:24,


示例24: main

int main(int argc, char *argv[]) {  Q_INIT_RESOURCE(RobotTreeModel);  QFile xmlFile(":/defaultRobot.xml");  RobotIO robotBuilder(&xmlFile);  robotBuilder.build();  LOG_DEBUG("Robot build finished!");  QApplication app(argc, argv);  MainWindow window(robotBuilder.getRobotPointer());#if defined(Q_OS_SYMBIAN)  window.showMaximized();#else  window.show();#endif  return app.exec();}
开发者ID:Kaldie,项目名称:GeRoBot,代码行数:16,


示例25: parseTagFile

void parseTagFile(Entry *root,const char *fullName,const char *tagName){  QFileInfo fi(fullName);  if (!fi.exists()) return;  TagFileParser handler( tagName );  handler.setFileName(fullName);  TagFileErrorHandler errorHandler;  QFile xmlFile( fullName );  QXmlInputSource source( xmlFile );  QXmlSimpleReader reader;  reader.setContentHandler( &handler );  reader.setErrorHandler( &errorHandler );  reader.parse( source );  handler.buildLists(root);  handler.addIncludes();}
开发者ID:tch-opensrc,项目名称:TC72XX_LxG1.7.1mp1_OpenSrc,代码行数:16,


示例26: QAbstractListModel

TipsOfTheDay::TipsOfTheDay(QString xmlPath, QObject *parent) : QAbstractListModel(parent){    tipList = new QList<TipOfTheDay>;    QFile xmlFile(xmlPath);    QTextStream errorStream(stderr);    if (!QFile::exists(xmlPath)) {        errorStream << tr("File does not exist./n");        return;    } else if (!xmlFile.open(QIODevice::ReadOnly)) {        errorStream << tr("Failed to open file./n");        return;    }    QXmlStreamReader reader(&xmlFile);    while (!reader.atEnd()) {        if (reader.readNext() == QXmlStreamReader::EndElement) {            break;        }        if (reader.name() == "tip") {            QString title, content, imagePath;            QDate date;            reader.readNext();            while (!reader.atEnd()) {                if (reader.readNext() == QXmlStreamReader::EndElement) {                    break;                }                if (reader.name() == "title") {                    title = reader.readElementText();                } else if (reader.name() == "text") {                    content = reader.readElementText();                } else if (reader.name() == "image") {                    imagePath = "theme:tips/images/" + reader.readElementText();                } else if (reader.name() == "date") {                    date = QDate::fromString(reader.readElementText(), Qt::ISODate);                } else {                    // unkown element, do nothing                }            }            tipList->append(TipOfTheDay(title, content, imagePath, date));        }    }}
开发者ID:Cockatrice,项目名称:Cockatrice,代码行数:47,


示例27: importMusicXml

Score::FileError importMusicXml(Score* score, const QString& name)      {      qDebug("importMusicXml(%p, %s)", score, qPrintable(name));      // open the MusicXML file      QFile xmlFile(name);      if (!xmlFile.exists())            return Score::FileError::FILE_NOT_FOUND;      if (!xmlFile.open(QIODevice::ReadOnly)) {            qDebug("importMusicXml() could not open MusicXML file '%s'", qPrintable(name));            MScore::lastError = QObject::tr("Could not open MusicXML file/n%1").arg(name);            return Score::FileError::FILE_OPEN_ERROR;            }      // and import it      return doValidateAndImport(score, name, &xmlFile);      }
开发者ID:FryderykChopin,项目名称:MuseScore,代码行数:17,



注:本文中的xmlFile函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ xmlFreeDoc函数代码示例
C++ xmlDocSetRootElement函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。