33 TiXmlDocument document(m_Filename);
34 if (!document.LoadFile())
36 MITK_ERROR <<
"Could not open/read/parse " << m_Filename <<
"\nTinyXML reports: " << document.ErrorDesc()
43 TiXmlElement *versionObject = document.FirstChildElement(
"Version");
46 if (versionObject->QueryIntAttribute(
"FileVersion", &fileVersion) != TIXML_SUCCESS)
48 MITK_ERROR <<
"Property file " << m_Filename <<
" does not contain version information! Trying version 1 format."
53 std::stringstream propertyListDeserializerClassName;
54 propertyListDeserializerClassName <<
"PropertyListDeserializerV" << fileVersion;
56 std::list<itk::LightObject::Pointer> readers =
57 itk::ObjectFactoryBase::CreateAllInstance(propertyListDeserializerClassName.str().c_str());
58 if (readers.size() < 1)
60 MITK_ERROR <<
"No property list reader found for file version " << fileVersion;
62 if (readers.size() > 1)
64 MITK_WARN <<
"Multiple property list readers found for file version " << fileVersion
65 <<
". Using arbitrary first one.";
68 for (
auto iter = readers.begin(); iter != readers.end(); ++iter)
72 reader->SetFilename(m_Filename);
73 bool success = reader->Deserialize();
75 m_PropertyList = reader->GetOutput();
79 MITK_ERROR <<
"There were errors while loading property list file " << m_Filename
80 <<
". Your data may be corrupted";
91 return m_PropertyList;
virtual bool Deserialize()
Reads a propertylist from file.
virtual ~PropertyListDeserializer()
Deserializes a mitk::PropertyList.
virtual PropertyList::Pointer GetOutput()
PropertyListDeserializer()