b.append(((BaseRuntimeDeclaredChildDefinition) nextChild).getElementName());
b.append(" has type ");
b.append(type);
b.append(" but this is not a valid type for this element");
if (nextChild instanceof RuntimeChildChoiceDefinition) {
RuntimeChildChoiceDefinition choice = (RuntimeChildChoiceDefinition) nextChild;
b.append(" - Expected one of: " + choice.getValidChildTypes());
}
throw new DataFormatException(b.toString());
}
throw new DataFormatException(nextChild + " has no child of type " + type);
}