void XMLRead::readXML(QString _filename) { QDomDocument doc("xmlfile"); QFile file(_filename); if (!file.open(QIODevice::ReadOnly)) return; QString errors = ""; if (!doc.setContent(&file,false,&errors)) { file.close(); qDebug() << "file closed, errors: " << errors; return; } file.close(); QDomElement docElem = doc.documentElement(); QDomNodeList nodeList = docElem.elementsByTagName("file"); // qDebug() << "nodeList.count(): " << nodeList.count(); if (nodeList.count() > 0) { for(int iDx = 0;iDx < nodeList.count(); iDx++) { //qDebug() << nodeList.at(iDx).nodeName(); readFileMeta(nodeList.at(iDx)); } } }
ReturnStatus FileMetaDAO::getFile(const std::string &path, FileMeta *pMeta) { assert(pMeta); Channel* pDataChannel = ChannelManager::getInstance()->Mapping(m_BucketId); NameSpace *DataNS = pDataChannel->m_DataNS; // clear possible data pMeta->m_BlockList.clear(); ReturnStatus rs; rs = isfile(path); if (!rs.success()) { return rs; } int rt = 0; Args fd; fd = DataNS->Open(path.c_str(), O_RDONLY); if (false == fd.valid) { ERROR_LOG("path %s, open() error, %s.", path.c_str(), strerror(errno)); return ReturnStatus(MU_FAILED, MU_UNKNOWN_ERROR); } rs = readFileMeta(&fd, pMeta); DataNS->Close(&fd); if (!rs.success()) { ERROR_LOG("path %s, readFileMeta() error", path.c_str()); } return rs; }