"The root element must have the name '"
+ xmlStyle.getScoreTagName() + "'. The invalid name used "
+ "was '" + element.getName() + "'."
);
}
Score returnScore = new Score();
String attributeValue;
attributeValue = XMLStyles.getTitleAttributeValue(element);
if (!attributeValue.equals("")) {
returnScore.setTitle(attributeValue);
}
attributeValue = XMLStyles.getTempoAttributeValue(element);
if (!attributeValue.equals("")) {
try {
returnScore.setTempo(
Double.valueOf(attributeValue).doubleValue());
} catch (NumberFormatException e) {
throw new ConversionException(
"Invalid attribute value: " + attributeValue + ". The "
+ "attribute '" + xmlStyle.getTempoAttributeName() + "' of element '"
+ xmlStyle.getScoreTagName() + "' must represent a Java double."
);
}
}
attributeValue = XMLStyles.getKeySignatureAttributeValue(element);
if (!attributeValue.equals("")) {
try {
returnScore.setKeySignature(Integer.parseInt(attributeValue));
} catch (NumberFormatException e) {
throw new ConversionException(
"Invalid attribute value: " + attributeValue + ". The "
+ "attribute '" + xmlStyle.getKeySignatureAttributeName() + "' of element '"
+ xmlStyle.getScoreTagName() + "' must represent a Java integer."
);
}
}
attributeValue = XMLStyles.getKeyQualityAttributeValue(element);
if (!attributeValue.equals("")) {
try {
returnScore.setKeyQuality(Integer.parseInt(attributeValue));
} catch (NumberFormatException e) {
throw new ConversionException(
"Invalid attribute value: " + attributeValue + ". The "
+ "attribute '" + xmlStyle.getKeyQualityAttributeName() + "' of element '"
+ xmlStyle.getScoreTagName() + "' must represent a Java integer."
);
}
}
attributeValue = XMLStyles.getNumeratorAttributeValue(element);
if (!attributeValue.equals("")) {
try {
returnScore.setNumerator(Integer.parseInt(attributeValue));
} catch (NumberFormatException e) {
throw new ConversionException(
"Invalid attribute value: " + attributeValue + ". The "
+ "attribute '" + xmlStyle.getNumeratorAttributeName() + "' of element '"
+ xmlStyle.getScoreTagName() + "' must represent a Java integer."
);
}
}
attributeValue = XMLStyles.getDenominatorAttributeValue(element);
if (!attributeValue.equals("")) {
try {
returnScore.setDenominator(Integer.parseInt(attributeValue));
} catch (NumberFormatException e) {
throw new ConversionException(
"Invalid attribute value: " + attributeValue + ". The "
+ "attribute '" + xmlStyle.getDenominatorAttributeName() + "' of element '"
+ xmlStyle.getScoreTagName() + "' must represent a Java integer."
);
}
}
Element[] children = element.getChildren();
for (int i = 0; i < children.length; i++) {
if (XMLStyles.isValidPartTag(children[i].getName())) {
returnScore.addPart(elementToPart(children[i]));
}
}
return returnScore;
}