Barline.parse constructor
Barline.parse(
- XmlElement xmlBarline,
- MusicXMLParserState state
Parse the MusicXML
Implementation
factory Barline.parse(XmlElement xmlBarline, MusicXMLParserState state) {
BarStyle? barStyle;
RightLeftMiddle? location;
// Parse children
for (final child in xmlBarline.childElements) {
switch (child.name.local) {
case 'bar-style':
barStyle = _parseBarStyle(child.innerText);
break;
default:
// Ignore other tag types because they are not relevant to Magenta.
}
}
// Parse attributes
for (final attribute in xmlBarline.attributes) {
final name = attribute.name.local;
final value = attribute.value;
switch (name) {
case 'location':
location = parseRightLeftMiddle(value);
break;
default:
// Add implementation above
break;
}
}
return Barline(barStyle, location);
}