Beispiel #1
0
musicxml::score_timewise
musicxml::parse<musicxml::score_timewise>(std::istream &is,
                                          const std::string &id) {
  xml::auto_initializer xerces_platform { true, false };

  std::unique_ptr<DOMDocument> doc { dom_document(is, id, true) };
  DOMElement *root { doc->getDocumentElement() };

  std::string const ns { xml::transcode<char>(root->getNamespaceURI()) };
  std::string const name { xml::transcode<char>(root->getLocalName()) };

  if (ns == "") {
    if (name == "score-partwise") {
      return musicxml::convert(musicxml::score_partwise{*root});
    } else if (name == "score-timewise") {
      return musicxml::score_timewise{*root};
    }
  }

  throw tree::unexpected_element<char>(name, ns,
                                       "score-partwise|score-timewise", "");
}