Qt 中sax方式 解析 xml文件
发布时间:2020-12-16 05:07:12 所属栏目:百科 来源:网络整理
导读:1 bool CSFCfgFileBase :: LoadConfigFile ( const QString strCfgFile ) { if ( strCfgFile != "" ) { m_strConfigFileName = strCfgFile; } QFile file( m_strConfigFileName ); if (!file. open ( QFile :: ReadOnly | QFile :: Text )) { return false ;
1 bool CSFCfgFileBase::LoadConfigFile( const QString &strCfgFile ) { if( strCfgFile != "" ) {
m_strConfigFileName = strCfgFile; }
QFile file(m_strConfigFileName); if (!file.open(QFile::ReadOnly | QFile::Text)) {
return false; }
file.seek( 0 ); QXmlInputSource xmlInputSource(&file); QXmlSimpleReader reader; reader.setContentHandler(this); reader.setErrorHandler(this); bool bResult = reader.parse( xmlInputSource ); file.close(); if( bResult ) {
InitAllFeatures(); m_bCfgLoaded = true; }
return m_bCfgLoaded; } 2.bool CSFCfgFileValueExchange::startElement(const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts){if( m_eCurrentRoute == XRT_FEATURE && m_slParseRoute.size() == XRL_FEATURE ) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |