DomDocument document = referenceSourceParentElement.getModelInstance().getDocument();
Collection<Source> referenceSourceElements = referenceSourceCollection.get(referenceSourceParentElement);
Collection<DomElement> referenceTargetElements = new ArrayList<DomElement>();
for (Source referenceSourceElement : referenceSourceElements) {
String identifier = getReferenceIdentifier(referenceSourceElement);
DomElement referenceTargetElement = document.getElementById(identifier);
if (referenceTargetElement != null) {
referenceTargetElements.add(referenceTargetElement);
}
else {
throw new ModelException("Unable to find a model element instance for id " + identifier);