// Start 'file': Save the target locale string.
if (targetLocaleString == null) {
targetLocaleString = atts.getValue("target-language");
} else {
if (!atts.getValue("target-language").equals(targetLocaleString)) {
throw new SoyMsgException(
"If XLIFF input contains multiple 'file' elements, they must have the same" +
" 'target-language'.");
}
}
} else if (qName.equals("trans-unit")) {
// Start 'trans-unit': Save the message id.
String id = atts.getValue("id");
try {
currMsgId = Long.parseLong(id);
} catch (NumberFormatException e) {
throw new SoyMsgException(
"Invalid message id '" + id + "' could not have been generated by the Soy compiler.");
}
} else if (qName.equals("target")) {
// Start 'target': Prepare to collect the message parts (coming next).
currMsgParts = Lists.newArrayList();
currRawTextPart = null;
isInMsg = true;
} else if (isInMsg) {
if (!qName.equals("x")) {
throw new SoyMsgException(
"In messages extracted by the Soy compiler, all placeholders should be element 'x'" +
" (found element '" + qName + "' in message).");
}
// Placeholder in message: Save the preceding raw text (if any) and then save the
// placeholder name.