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

Method startElement

src/openms/source/FORMAT/VALIDATORS/MzMLValidator.cpp:33–90  ·  view source on GitHub ↗

This method needed to be reimplemented to - check CV term values - handle referenceableParamGroups - check if binaryDataArray name and type match

Source from the content-addressed store, hash-verified

31 // - handle referenceableParamGroups
32 // - check if binaryDataArray name and type match
33 void MzMLValidator::startElement(const XMLCh * const /*uri*/, const XMLCh * const /*local_name*/, const XMLCh * const qname, const Attributes & attributes)
34 {
35 String tag = sm_.convert(qname);
36 String parent_tag;
37 if (!open_tags_.empty())
38 {
39 parent_tag = open_tags_.back();
40 }
41 String path = getPath_() + "/" + cv_tag_ + "/@" + accession_att_;
42 open_tags_.push_back(tag);
43
44 if (tag == "referenceableParamGroup")
45 {
46 current_id_ = attributeAsString_(attributes, "id");
47 }
48 else if (tag == "referenceableParamGroupRef")
49 {
50 const std::vector<CVTerm> & terms = param_groups_[attributeAsString_(attributes, "ref")];
51 for (Size i = 0; i < terms.size(); ++i)
52 {
53 handleTerm_(path, terms[i]);
54 }
55 }
56 else if (tag == "binaryDataArray")
57 {
58 binary_data_array_ = "";
59 binary_data_type_ = "";
60 }
61 else if (tag == cv_tag_)
62 {
63 //extract accession, name and value
64 CVTerm parsed_term;
65 getCVTerm_(attributes, parsed_term);
66
67 //check if the term is unknown
68 if (!cv_.exists(parsed_term.accession))
69 {
70 warnings_.push_back(String("Unknown CV term: '") + parsed_term.accession + " - " + parsed_term.name + "' at element '" + getPath_(1) + "'");
71 return;
72 }
73
74 //check if the term is obsolete
75 if (cv_.getTerm(parsed_term.accession).obsolete)
76 {
77 warnings_.push_back(String("Obsolete CV term: '") + parsed_term.accession + " - " + parsed_term.name + "' at element '" + getPath_(1) + "'");
78 }
79
80 //actual handling of the term
81 if (parent_tag == "referenceableParamGroup")
82 {
83 param_groups_[current_id_].push_back(parsed_term);
84 }
85 else
86 {
87 handleTerm_(path, parsed_term);
88 }
89 }
90 }

Callers

nothing calls this directly

Calls 8

attributeAsString_Function · 0.85
backMethod · 0.80
StringClass · 0.50
convertMethod · 0.45
emptyMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected