{
// TODO: Ideally we don't want to manipulate the original
// dominant document but use its copy for merge.
//Document mDoc = (Document) dDocument.clone(); // doesn't merge properly
Document mDoc = dDocument;
ComponentSetElement dCSE = new ComponentSetElement( mDoc.getRootElement() );
ComponentSetElement rCSE = new ComponentSetElement( rDocument.getRootElement() );
dCSE.merge( rCSE );
// the contents are merged into the dominant document DOM.
return mDoc;
}