use of com.xenoage.utils.xml.XmlDataException in project Zong by Xenoage.
the class MusicXmlScoreFileInput method read.
/**
* Creates a {@link Score} instance from the document
* behind the given {@link InputStream}.
* @param inputStream the input stream with the MusicXML document
* @param filePath file path if known, null otherwise
*/
@Override
public Score read(InputStream stream, @MaybeNull String filePath) throws InvalidFormatException, IOException {
// parse MusicXML file
MxlScorePartwise score;
try {
XmlReader xmlReader = platformUtils().createXmlReader(stream);
MusicXMLDocument doc = MusicXMLDocument.read(xmlReader);
score = doc.getScore();
} catch (XmlDataException ex) {
// no valid MusicXML
throw new InvalidFormatException(ex);
} catch (Exception ex) {
throw new IOException(ex);
}
return read(score, Level.LogErrors);
}
Aggregations