| 81 | } |
| 82 | |
| 83 | void ValidateElement(pugi::xml_node const & nodeOrWay) |
| 84 | { |
| 85 | using editor::XMLFeature; |
| 86 | |
| 87 | if (!nodeOrWay) |
| 88 | MYTHROW(editor::InvalidXML, ("Document has no valid root element.")); |
| 89 | |
| 90 | auto const type = XMLFeature::StringToType(nodeOrWay.name()); |
| 91 | |
| 92 | if (type == XMLFeature::Type::Unknown) |
| 93 | MYTHROW(editor::InvalidXML, ("XMLFeature does not support root tag", nodeOrWay.name())); |
| 94 | |
| 95 | if (type == XMLFeature::Type::Node) |
| 96 | UNUSED_VALUE(GetLatLonFromNode(nodeOrWay)); |
| 97 | |
| 98 | if (!nodeOrWay.attribute(kTimestamp)) |
| 99 | MYTHROW(editor::NoTimestamp, ("Node has no timestamp attribute")); |
| 100 | } |
| 101 | } // namespace |
| 102 | |
| 103 | XMLFeature::XMLFeature(Type const type) |
no test coverage detected