void Config::init(){ QDomElement root; try{ root = Utils::openXml(":/Army/list.xml"); } catch(...){ return; } if(root.tagName() != "list") throw tr("Fichier mal formaté"); QDomNode n = root.firstChild(); ArmyFactory *factory = new ArmyFactory(); while(!n.isNull()){ QDomElement e = n.toElement(); if(e.tagName() == "army" && e.nodeType() == QDomNode::ElementNode && e.childNodes().count() == 1){ QString ids = e.attribute("id",""); if(ids == "") //No id, and we need it ! continue; bool ok; qint32 id = ids.toInt(&ok); if(!ok) //it's not and Int continue; this->m_mArmyList.push_back( factory->getArmy(e.text(),id)); } n = n.nextSibling(); } }
void domNotImplemented(QDomElement e) { if (!MScore::debugMsg) return; QString s = domElementPath(e); if (!docName.isEmpty()) fprintf(stderr, "<%s>:", qPrintable(docName)); fprintf(stderr, "%s: Node not implemented: <%s>, type %d\n", qPrintable(s), qPrintable(e.tagName()), e.nodeType()); if (e.isText()) fprintf(stderr, " text node <%s>\n", qPrintable(e.toText().data())); }
void domNotImplemented(const QDomElement& e) { if (!MScore::debugMode) return; QString s = domElementPath(e); if (!docName.isEmpty()) qDebug("<%s>:", qPrintable(docName)); qDebug("%s: Node not implemented: <%s>, type %d\n", qPrintable(s), qPrintable(e.tagName()), e.nodeType()); if (e.isText()) qDebug(" text node <%s>\n", qPrintable(e.toText().data())); }
void domError(QDomElement e) { QString s = domElementPath(e); if (!docName.isEmpty()) fprintf(stderr, "<%s>:", qPrintable(docName)); int ln = e.lineNumber(); if (ln != -1) fprintf(stderr, "line:%d ", ln); int col = e.columnNumber(); if (col != -1) fprintf(stderr, "col:%d ", col); fprintf(stderr, "%s: Unknown Node <%s>, type %d\n", qPrintable(s), qPrintable(e.tagName()), e.nodeType()); if (e.isText()) fprintf(stderr, " text node <%s>\n", qPrintable(e.toText().data())); }
void domError(const QDomElement& e) { QString m; QString s = domElementPath(e); if (!docName.isEmpty()) m = QString("<%1>:").arg(docName); int ln = e.lineNumber(); if (ln != -1) m += QString("line:%1 ").arg(ln); int col = e.columnNumber(); if (col != -1) m += QString("col:%1 ").arg(col); m += QString("%1: Unknown Node <%2>, type %3").arg(s).arg(e.tagName()).arg(e.nodeType()); if (e.isText()) m += QString(" text node <%1>").arg(e.toText().data()); qDebug("%s", qPrintable(m)); }