public static String getCMDKeyForDelimitedFile(final MetaData columnMD, final List<String> lineElements) {
        if (!columnMD.isAnyRecordFormatSpecified()) {
            // no <RECORD> elments were specifed for this parse, just return the
            // detail id
            return FPConstants.DETAIL_ID;
        }
        final Iterator<Entry<String, XMLRecordElement>> mapEntries = columnMD.xmlRecordIterator();
        // loop through the XMLRecordElement objects and see if we need a
        // different MD object
        while (mapEntries.hasNext()) {
            final Entry<String, XMLRecordElement> entry = mapEntries.next();
            final XMLRecordElement recordXMLElement = entry.getValue();

            if (recordXMLElement.getElementCount() > 0 && recordXMLElement.getElementCount() == lineElements.size()) {
                // determing which <record> mapping to use by the number of elements
                // contained on the line
                return entry.getKey();
            } else if (recordXMLElement.getElementNumber() > lineElements.size()) {
                // make sure the element referenced in the mapping exists
                continue;
            }

            final String lineElement = lineElements.get(recordXMLElement.getElementNumber() - 1);
            if (lineElement.equals(recordXMLElement.getIndicator())) {
                // we found the MD object we want to return
                return entry.getKey();
            }

        }

        // must be a detail line
        return FPConstants.DETAIL_ID;
    }