diff --git a/src/config-store/examples/config-store-save.cc b/src/config-store/examples/config-store-save.cc index d75d601ef..33a8a9b6c 100644 --- a/src/config-store/examples/config-store-save.cc +++ b/src/config-store/examples/config-store-save.cc @@ -49,6 +49,7 @@ int main (int argc, char *argv[]) // ConfigureAttributes() will work below. Config::RegisterRootNamespaceObject (a2_obj); +#ifdef HAVE_LIBXML2 // Output config store to XML format Config::SetDefault ("ns3::ConfigStore::Filename", StringValue ("output-attributes.xml")); Config::SetDefault ("ns3::ConfigStore::FileFormat", StringValue ("Xml")); @@ -56,6 +57,7 @@ int main (int argc, char *argv[]) ConfigStore outputConfig; outputConfig.ConfigureDefaults (); outputConfig.ConfigureAttributes (); +#endif /* HAVE_LIBXML2 */ // Output config store to txt format Config::SetDefault ("ns3::ConfigStore::Filename", StringValue ("output-attributes.txt")); diff --git a/src/config-store/model/config-store.cc b/src/config-store/model/config-store.cc index 96eb812f0..48262e7eb 100644 --- a/src/config-store/model/config-store.cc +++ b/src/config-store/model/config-store.cc @@ -1,5 +1,6 @@ #include "config-store.h" #include "raw-text-config.h" +#include "ns3/abort.h" #include "ns3/string.h" #include "ns3/log.h" #include "ns3/simulator.h" @@ -77,8 +78,20 @@ ConfigStore::ConfigStore () m_file = new NoneFileConfig (); } } - else +#else + if (m_fileFormat == ConfigStore::XML) + { + if (m_mode == ConfigStore::SAVE || m_mode == ConfigStore::LOAD) + { + NS_ABORT_MSG ("ConfigStore tried to read or write an XML file but XML is not supported."); + } + else + { + m_file = new NoneFileConfig (); + } + } #endif /* HAVE_LIBXML2 */ + if (m_fileFormat == ConfigStore::RAW_TEXT) { if (m_mode == ConfigStore::SAVE)