Don't ignore broken xml data.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-10-08 09:43:29 +03:00
parent 2a742497ea
commit 7ed0f2760b

View File

@ -117,7 +117,7 @@ void VPattern::Parse(const Document &parse)
SCASSERT(sceneDraw != nullptr); SCASSERT(sceneDraw != nullptr);
SCASSERT(sceneDetail != nullptr); SCASSERT(sceneDetail != nullptr);
QStringList tags = QStringList() << TagDraw << TagIncrements << TagAuthor << TagDescription << TagNotes QStringList tags = QStringList() << TagDraw << TagIncrements << TagAuthor << TagDescription << TagNotes
<< TagMeasurements << TagVersion << TagGradation; << TagMeasurements << TagVersion << TagGradation << TagUnit;
PrepareForParse(parse); PrepareForParse(parse);
QDomNode domNode = documentElement().firstChild(); QDomNode domNode = documentElement().firstChild();
while (domNode.isNull() == false) while (domNode.isNull() == false)
@ -171,6 +171,9 @@ void VPattern::Parse(const Document &parse)
case 7: // TagGradation case 7: // TagGradation
qCDebug(vXML, "Tag gradation."); qCDebug(vXML, "Tag gradation.");
break; break;
case 8: // TagUnit
qCDebug(vXML, "Tag unit.");
break;
default: default:
qCDebug(vXML, "Wrong tag name %s", qUtf8Printable(domElement.tagName())); qCDebug(vXML, "Wrong tag name %s", qUtf8Printable(domElement.tagName()));
break; break;
@ -488,8 +491,8 @@ void VPattern::ParseDrawElement(const QDomNode &node, const Document &parse)
ParseDetails(domElement, parse); ParseDetails(domElement, parse);
break; break;
default: default:
qCDebug(vXML, "Wrong tag name"); VException e(tr("Wrong tag name '%1'.").arg(domElement.tagName()));
break; throw e;
} }
} }
} }
@ -548,8 +551,8 @@ void VPattern::ParseDrawMode(const QDomNode &node, const Document &parse, const
ParseToolsElement(scene, domElement, parse, domElement.attribute(AttrType, "")); ParseToolsElement(scene, domElement, parse, domElement.attribute(AttrType, ""));
break; break;
default: default:
qCDebug(vXML, "Wrong tag name"); VException e(tr("Wrong tag name '%1'.").arg(domElement.tagName()));
break; throw e;
} }
} }
} }
@ -610,9 +613,8 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
tool = Tool::NodeSplinePath; tool = Tool::NodeSplinePath;
break; break;
default: default:
qDebug()<<"Wrong node type."<<Q_FUNC_INFO; VException e(tr("Wrong tag name '%1'.").arg(t));
continue; throw e;
break;
} }
detail.append(VNodeDetail(id, tool, nodeType, mx, my, reverse)); detail.append(VNodeDetail(id, tool, nodeType, mx, my, reverse));
} }