Loop through elements by element set

What is the best way to loop through elements by element set? Right now I have this for "Item Type Metadata" but I'm not sure how to accomplish something similar for Dublin Core elements.

<?php
// Display Item Type Metadata
if( $type=$item->getItemType()['name'] ){
	echo '<h2>'.$type.' Item Type Metadata</h2>';
	$elements=item_type_elements($item);
	foreach(array_keys($elements) as $element){
		echo '<h3>'.$element.'</h3>';
		echo '<p>'.metadata($item, array('Item Type Metadata',$element) ).'</p>';
	}

}
?>

The purpose is to allow for various conditional checks and field re-ordering.

Note: on the reordering front, that's directly possible already through Settings > Element Sets and Settings > Item Type Elements.