if (! XMLStyles.isValidNoteTag(element.getName())) {
throw new ConversionException(
"Invalid element: " + element.getName() + ". The only "
+ "accepted tag name is '" + xmlStyle.getNoteTagName() + "'.");
}
Note returnNote = new Note();
String attributeValue;
attributeValue = XMLStyles.getPitchAttributeValue(element);
if (! attributeValue.equals("")) {
try {
returnNote.setPitch(Integer.parseInt(attributeValue));
} catch (NumberFormatException e) {
throw new ConversionException(
"Invalid attribute value: " + attributeValue + ". The "
+ "attribute '" + xmlStyle.getPitchAttributeName() + "' of element '"
+ xmlStyle.getNoteTagName() + "' must represent a Java integer.");
}
}
attributeValue = XMLStyles.getFrequencyAttributeValue(element);
if (! attributeValue.equals("")) {
try {
double tempVal = Double.valueOf(attributeValue).doubleValue();
returnNote.setFrequency(tempVal);
} catch (NumberFormatException e) {
throw new ConversionException(
"Invalid attribute value: " + attributeValue + ". The "
+ "attribute '" + xmlStyle.getFrequencyAttributeName() + "' of element '"
+ xmlStyle.getNoteTagName() + "' must represent a Java double.");
}
}
attributeValue = XMLStyles.getDynamicAttributeValue(element);
if (! attributeValue.equals("")) {
try {
returnNote.setDynamic(Integer.parseInt(attributeValue));
} catch (NumberFormatException e) {
throw new ConversionException(
"Invalid attribute value: " + attributeValue + ". The "
+ "attribute '" + xmlStyle.getDynamicAttributeName() + "' of element '"
+ xmlStyle.getNoteTagName() + "' must represent a Java integer.");
}
}
attributeValue = XMLStyles.getRhythmValueAttributeValue(element);
if (! attributeValue.equals("")) {
try {
returnNote.setRhythmValue(
Double.valueOf(attributeValue).doubleValue());
} catch (NumberFormatException e) {
throw new ConversionException(
"Invalid attribute value: " + attributeValue + ". The "
+ "attribute '" + xmlStyle.getRhythmValueAttributeName() + "' of element '"
+ xmlStyle.getNoteTagName() + "' must represent a Java double.");
}
}
attributeValue = XMLStyles.getPanAttributeValue(element);
if (! attributeValue.equals("")) {
try {
returnNote.setPan(Double.valueOf(attributeValue).doubleValue());
} catch (NumberFormatException e) {
throw new ConversionException(
"Invalid attribute value: " + attributeValue + ". The "
+ "attribute '" + xmlStyle.getPanAttributeName() + "' of element '"
+ xmlStyle.getNoteTagName() + "' must represent a Java double.");
}
}
attributeValue = XMLStyles.getDurationAttributeValue(element);
if (! attributeValue.equals("")) {
try {
returnNote.setDuration(
Double.valueOf(attributeValue).doubleValue());
} catch (NumberFormatException e) {
throw new ConversionException(
"Invalid attribute value: " + attributeValue + ". The "
+ "attribute '" + xmlStyle.getDurationAttributeName() + "' of element '"
+ xmlStyle.getNoteTagName() + "' must represent a Java double.");
}
}
attributeValue = XMLStyles.getOffsetAttributeValue(element);
if (! attributeValue.equals("")) {
try {
returnNote.setOffset(
Double.valueOf(attributeValue).doubleValue());
} catch (NumberFormatException e) {
throw new ConversionException(
"Invalid attribute value: " + attributeValue + ". The "
+ "attribute '" + xmlStyle.getOffsetAttributeName() + "' of element '"
+ xmlStyle.getNoteTagName() + "' must represent a Java double.");
}
}
attributeValue = XMLStyles.getSampleStartTimeAttributeValue(element);
if (! attributeValue.equals("")) {
try {
returnNote.setSampleStartTime(
Double.valueOf(attributeValue).doubleValue());
} catch (NumberFormatException e) {
throw new ConversionException(
"Invalid attribute value: " + attributeValue + ". The "
+ "attribute '" + xmlStyle.getSampleStartTimeAttributeName() + "' of "