18 #include "NCLParser.h"
26 bool NCLParser::startElement(
const QString & ,
29 const QXmlAttributes &attributes)
31 QMap <QString, QString> attrs;
32 for(
int i = 0; i < attributes.length(); i++) {
33 attrs[attributes.localName(i)] = attributes.value(i);
37 currentItem = treeWidget->
addElement(currentItem,
38 currentItem->childCount(),
40 attributes.value(
"id"),
42 locator->lineNumber(),
43 locator->columnNumber());
48 attributes.value(
"id"),
50 locator->lineNumber(),
51 locator->columnNumber());
57 bool NCLParser::characters(
const QString &str)
63 bool NCLParser::endElement(
const QString & ,
67 currentItem = currentItem->parent();
71 bool NCLParser::fatalError(
const QXmlParseException &exception)
73 if(currentItem != NULL) {
74 currentItem->setIcon(0, QIcon(
":/images/error-icon-16.png"));
75 currentItem->setTextColor(0, QColor(
"#FF0000"));
79 qDebug() << QObject::tr(
"Parse error at line %1, column "
81 .arg(exception.lineNumber())
82 .arg(exception.columnNumber())
83 .arg(exception.message());
85 emit fatalErrorFound ( exception.message(),
87 exception.lineNumber(),
88 exception.columnNumber(),
94 void NCLParser::setDocumentLocator(QXmlLocator *locator)
96 this->locator = locator;