| 124 | } |
| 125 | |
| 126 | void TransformationXMLFile::startElement(const XMLCh* const /*uri*/, const XMLCh* const /*local_name*/, const XMLCh* const qname, const xercesc::Attributes& attributes) |
| 127 | { |
| 128 | |
| 129 | String element = sm_.convert(qname); |
| 130 | |
| 131 | if (element == "TrafoXML") |
| 132 | { |
| 133 | //check file version against schema version |
| 134 | double file_version = attributeAsDouble_(attributes, "version"); |
| 135 | if (file_version > version_.toDouble()) |
| 136 | { |
| 137 | warning(LOAD, String("The XML file (") + file_version + ") is newer than the parser (" + version_ + "). This might lead to undefined program behavior."); |
| 138 | } |
| 139 | } |
| 140 | else if (element == "Transformation") |
| 141 | { |
| 142 | model_type_ = attributeAsString_(attributes, "name"); |
| 143 | } |
| 144 | else if (element == "Param") |
| 145 | { |
| 146 | String type = attributeAsString_(attributes, "type"); |
| 147 | if (type == "int") |
| 148 | { |
| 149 | params_.setValue(attributeAsString_(attributes, "name"), attributeAsInt_(attributes, "value")); |
| 150 | } |
| 151 | else if (type == "float") |
| 152 | { |
| 153 | params_.setValue(attributeAsString_(attributes, "name"), attributeAsDouble_(attributes, "value")); |
| 154 | } |
| 155 | else if (type == "string") |
| 156 | { |
| 157 | params_.setValue(attributeAsString_(attributes, "name"), String(attributeAsString_(attributes, "value"))); |
| 158 | } |
| 159 | else |
| 160 | { |
| 161 | error(LOAD, String("Unsupported parameter type: '") + type + "'"); |
| 162 | } |
| 163 | |
| 164 | } |
| 165 | else if (element == "Pairs") |
| 166 | { |
| 167 | data_.reserve(attributeAsInt_(attributes, "count")); |
| 168 | } |
| 169 | else if (element == "Pair") |
| 170 | { |
| 171 | TransformationDescription::DataPoint point; |
| 172 | point.first = attributeAsDouble_(attributes, "from"); |
| 173 | point.second = attributeAsDouble_(attributes, "to"); |
| 174 | optionalAttributeAsString_(point.note, attributes, "note"); |
| 175 | data_.push_back(point); |
| 176 | } |
| 177 | else |
| 178 | { |
| 179 | warning(LOAD, String("Unknown element: '") + element + "'"); |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | } // namespace OpenMS |
nothing calls this directly
no test coverage detected