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

Function parse

src/openms/source/FORMAT/XMLFile.cpp:72–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70 }
71
72 void parse(xercesc::InputSource* const source, XMLHandler* handler)
73 {
74 unique_ptr<xercesc::SAX2XMLReader> parser(xercesc::XMLReaderFactory::createXMLReader());
75
76 parser->setFeature(xercesc::XMLUni::fgSAX2CoreNameSpaces, false);
77 parser->setFeature(xercesc::XMLUni::fgSAX2CoreNameSpacePrefixes, false);
78
79 parser->setContentHandler(handler);
80 parser->setErrorHandler(handler);
81
82
83 // try to parse file
84 try
85 {
86 parser->parse(*source);
87 }
88 catch (const xercesc::XMLException& toCatch)
89 {
90 throw Exception::ParseError(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "", String("XMLException: ") + StringManager().convert(toCatch.getMessage()));
91 }
92 catch (const xercesc::SAXException& toCatch)
93 {
94 throw Exception::ParseError(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "", String("SAXException: ") + StringManager().convert(toCatch.getMessage()));
95 }
96 catch (const XMLHandler::EndParsingSoftly& /*toCatch*/)
97 {
98 // nothing to do here, as this exception is used to softly abort the
99 // parsing for whatever reason.
100 }
101 catch (...)
102 {
103 // re-throw
104 throw;
105 }
106 }
107
108 void XMLFile::parse_(const String & filename, XMLHandler * handler)
109 {

Callers 7

parse_Method · 0.85
parseBuffer_Method · 0.85
loadMethod · 0.85
readFromJSON_Method · 0.85
extractDoubleFunction · 0.85

Calls 5

StringClass · 0.50
setFeatureMethod · 0.45
parseMethod · 0.45
convertMethod · 0.45
getMessageMethod · 0.45

Tested by

no test coverage detected