MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / startElement

Method startElement

src/openms/source/FORMAT/HANDLERS/FeatureXMLHandler.cpp:240–700  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238 }
239
240 void FeatureXMLHandler::startElement(const XMLCh* const /*uri*/, const XMLCh* const /*local_name*/, const XMLCh* const qname, const xercesc::Attributes& attributes)
241 {
242 static const XMLCh* s_dim = xercesc::XMLString::transcode("dim");
243 static const XMLCh* s_name = xercesc::XMLString::transcode("name");
244 static const XMLCh* s_version = xercesc::XMLString::transcode("version");
245 static const XMLCh* s_value = xercesc::XMLString::transcode("value");
246 static const XMLCh* s_type = xercesc::XMLString::transcode("type");
247 static const XMLCh* s_completion_time = xercesc::XMLString::transcode("completion_time");
248 static const XMLCh* s_document_id = xercesc::XMLString::transcode("document_id");
249 static const XMLCh* s_id = xercesc::XMLString::transcode("id");
250
251 // TODO The next line should be removed in OpenMS 1.7 or so!
252 static const XMLCh* s_unique_id = xercesc::XMLString::transcode("unique_id");
253
254 String tag = sm_.convert(qname);
255
256 // handle skipping of whole sections
257 // IMPORTANT: check parent tags first (i.e. tags higher in the tree), since otherwise sections might be enabled/disabled too early/late
258 // disable_parsing_ is an Int, since subordinates might be chained, thus at SO-level 2, the endelement() would switch on parsing again
259 // , even though the end of the parent SO was not reached
260 if ((!options_.getLoadSubordinates()) && tag == "subordinate")
261 {
262 ++disable_parsing_;
263 }
264 else if ((!options_.getLoadConvexHull()) && tag == "convexhull")
265 {
266 ++disable_parsing_;
267 }
268 if (disable_parsing_)
269 {
270 return;
271 }
272 // do the actual parsing:
273 String parent_tag;
274 if (!open_tags_.empty())
275 {
276 parent_tag = open_tags_.back();
277 }
278 open_tags_.push_back(tag);
279
280 //for downward compatibility, all tags in the old description must be ignored
281 if (in_description_)
282 {
283 return;
284 }
285 if (tag == "description")
286 {
287 in_description_ = true;
288 }
289 else if (tag == "feature")
290 {
291 // create new feature at appropriate level
292 updateCurrentFeature_(true);
293 current_feature_->setUniqueId(attributeAsString_(attributes, s_id));
294 }
295 else if (tag == "subordinate") // this is not safe towards malformed xml!
296 {
297 ++subordinate_feature_level_;

Callers

nothing calls this directly

Calls 15

attributeAsString_Function · 0.85
attributeAsInt_Function · 0.85
attributeAsDouble_Function · 0.85
attributeAsIntList_Function · 0.85
attributeAsDoubleList_Function · 0.85
attributeAsStringList_Function · 0.85
asDateTime_Function · 0.85
getUniqueIdFunction · 0.85
optionalAttributeAsUInt_Function · 0.85
getInstanceFunction · 0.85

Tested by

no test coverage detected