Various attempts to clean up DCP comparison code.
[libdcp.git] / src / load_font.cc
index 707f4a0b54b07357dc54bab234334d63c54e0d4c..b46569c8ea5701593b336e0ccb3e210cf14f85ff 100644 (file)
 #include "load_font.h"
 #include <libcxml/cxml.h>
 
+using std::string;
 using boost::shared_ptr;
+using boost::optional;
 using namespace dcp;
 
 LoadFont::LoadFont (boost::shared_ptr<const cxml::Node> node)
 {
-       id = node->string_attribute ("Id");
-       uri = node->string_attribute ("URI");
+       optional<string> x = node->optional_string_attribute ("Id");
+       if (!x) {
+               x = node->optional_string_attribute ("ID");
+       }
+       id = x.get_value_or ("");
+       
+       uri = node->optional_string_attribute ("URI");
 }