diff --git a/Source/Model/Reader/NMR_ModelReaderNode_ModelBase.cpp b/Source/Model/Reader/NMR_ModelReaderNode_ModelBase.cpp index 773318837..710ac8867 100644 --- a/Source/Model/Reader/NMR_ModelReaderNode_ModelBase.cpp +++ b/Source/Model/Reader/NMR_ModelReaderNode_ModelBase.cpp @@ -159,23 +159,25 @@ namespace NMR { if (m_pModel->hasMetaData(sKey)) { m_pWarnings->addWarning(NMR_ERROR_DUPLICATEMETADATA, mrwInvalidOptionalValue); } - std::string sNameSpace, sName; - decomposeKeyIntoNamespaceAndName(sKey, sNameSpace, sName); - if (!sNameSpace.empty()) { - std::string sNameSpaceURI; - if (!pXMLReader->GetNamespaceURI(sNameSpace, sNameSpaceURI)) { - m_pWarnings->addException(CNMRException(NMR_ERROR_METADATA_COULDNOTGETNAMESPACE), mrwInvalidOptionalValue); - sNameSpaceURI = sNameSpace; - } - m_pModel->addMetaData(sNameSpaceURI, sName, sValue, sType, bPreserve); - } else { - // default namespace - if (CModelMetaData::isValidNamespaceAndName("", sName)) { - m_pModel->addMetaData("", sName, sValue, sType, bPreserve); + std::string sNameSpace, sName; + decomposeKeyIntoNamespaceAndName(sKey, sNameSpace, sName); + if (!sNameSpace.empty()) { + std::string sNameSpaceURI; + if (!pXMLReader->GetNamespaceURI(sNameSpace, sNameSpaceURI)) { + m_pWarnings->addException(CNMRException(NMR_ERROR_METADATA_COULDNOTGETNAMESPACE), mrwInvalidOptionalValue); + sNameSpaceURI = sNameSpace; + } + m_pModel->addMetaData(sNameSpaceURI, sName, sValue, sType, bPreserve); + } + else { + // default namespace + if (CModelMetaData::isValidNamespaceAndName("", sName)) { + m_pModel->addMetaData("", sName, sValue, sType, bPreserve); + } + else + m_pWarnings->addException(CNMRException(NMR_ERROR_UNKNOWNMETADATA), mrwInvalidOptionalValue); } - else - m_pWarnings->addException(CNMRException(NMR_ERROR_UNKNOWNMETADATA), mrwInvalidOptionalValue); } } else { diff --git a/Source/Model/Reader/v100/NMR_ModelReaderNode100_MetaDataGroup.cpp b/Source/Model/Reader/v100/NMR_ModelReaderNode100_MetaDataGroup.cpp index e9a872d55..4f26023d6 100644 --- a/Source/Model/Reader/v100/NMR_ModelReaderNode100_MetaDataGroup.cpp +++ b/Source/Model/Reader/v100/NMR_ModelReaderNode100_MetaDataGroup.cpp @@ -76,23 +76,25 @@ namespace NMR { if (m_MetaDataGroup->hasMetaData(sKey)) { m_pWarnings->addWarning(NMR_ERROR_DUPLICATEMETADATA, mrwInvalidOptionalValue); } - std::string sNameSpace, sName; - decomposeKeyIntoNamespaceAndName(sKey, sNameSpace, sName); - if (!sNameSpace.empty()) { - std::string sNameSpaceURI; - if (!pXMLReader->GetNamespaceURI(sNameSpace, sNameSpaceURI)) { - m_pWarnings->addException(CNMRException(NMR_ERROR_METADATA_COULDNOTGETNAMESPACE), mrwInvalidOptionalValue); - sNameSpaceURI = sNameSpace; - } - m_MetaDataGroup->addMetaData(sNameSpaceURI, sName, sValue, sType, bPreserve); - } else { - // default namespace - if (CModelMetaData::isValidNamespaceAndName("", sName)) { - m_MetaDataGroup->addMetaData("", sName, sValue, sType, bPreserve); + std::string sNameSpace, sName; + decomposeKeyIntoNamespaceAndName(sKey, sNameSpace, sName); + if (!sNameSpace.empty()) { + std::string sNameSpaceURI; + if (!pXMLReader->GetNamespaceURI(sNameSpace, sNameSpaceURI)) { + m_pWarnings->addException(CNMRException(NMR_ERROR_METADATA_COULDNOTGETNAMESPACE), mrwInvalidOptionalValue); + sNameSpaceURI = sNameSpace; + } + m_MetaDataGroup->addMetaData(sNameSpaceURI, sName, sValue, sType, bPreserve); + } + else { + // default namespace + if (CModelMetaData::isValidNamespaceAndName("", sName)) { + m_MetaDataGroup->addMetaData("", sName, sValue, sType, bPreserve); + } + else + m_pWarnings->addException(CNMRException(NMR_ERROR_UNKNOWNMETADATA), mrwInvalidOptionalValue); } - else - m_pWarnings->addException(CNMRException(NMR_ERROR_UNKNOWNMETADATA), mrwInvalidOptionalValue); } } else {