private AbstractSourceValue getSourceValue(
      final NodeInfo nodeInfo, final CtyImportMappingConfig mapping, final String base)
      throws Exception {
    AbstractSourceValue value = null;
    final String xpath = getXpathValue(base, mapping.getSource());
    if (!mapping.isMetaDataMapping() && mapping.isBinary()) {
      final byte[] byteValue = getBinaryValue(nodeInfo, xpath);
      if (byteValue != null) {
        value = new BinarySourceValue(byteValue);
      }
    } else if (!mapping.isMetaDataMapping() && mapping.isXml()) {
      final String xmlValue = getXmlValue(nodeInfo, xpath);
      if (xmlValue != null) {
        value = new StringSourceValue(xmlValue);
      }
    } else if (!mapping.isMetaDataMapping() && mapping.isHtml()) {
      final String htmlValue = getHtmlValue(nodeInfo, xpath);
      if (htmlValue != null) {
        value = new StringSourceValue(htmlValue);
      }
    } else if (!mapping.isMetaDataMapping() && mapping.isMultiple()) {
      final LinkedHashSet<String> stringsValue = getStringValues(nodeInfo, xpath);
      if (stringsValue != null) {
        value = new StringArraySourceValue(stringsValue);
      }
    } else {
      final String stringValue = getStringValue(nodeInfo, xpath);
      if (stringValue != null) {
        value = new StringSourceValue(stringValue);
      }
    }

    if (value != null && mapping.hasAdditionalSource()) {
      value.setAdditionalValue(
          getStringValue(nodeInfo, getXpathValue(base, mapping.getAdditionalSource())));
    }
    return value;
  }