protected void fillContentElement(Element contentElement, Content content) throws FeedException {

    String type = content.getType();
    String atomType = type;
    if (type != null) {
      // Fix for issue #39 "Atom 1.0 Text Types Not Set Correctly"
      // we're not sure who set this value, so ensure Atom types are used
      if ("text/plain".equals(type)) atomType = Content.TEXT;
      else if ("text/html".equals(type)) atomType = Content.HTML;
      else if ("application/xhtml+xml".equals(type)) atomType = Content.XHTML;

      Attribute typeAttribute = new Attribute("type", atomType);
      contentElement.setAttribute(typeAttribute);
    }
    String href = content.getSrc();
    if (href != null) {
      Attribute srcAttribute = new Attribute("src", href);
      contentElement.setAttribute(srcAttribute);
    }
    if (content.getValue() != null) {
      if (atomType != null
          && (atomType.equals(Content.XHTML)
              || (atomType.indexOf("/xml")) != -1
              || (atomType.indexOf("+xml")) != -1)) {

        StringBuffer tmpDocString = new StringBuffer("<tmpdoc>");
        tmpDocString.append(content.getValue());
        tmpDocString.append("</tmpdoc>");
        StringReader tmpDocReader = new StringReader(tmpDocString.toString());
        Document tmpDoc;
        try {
          SAXBuilder saxBuilder = new SAXBuilder();
          tmpDoc = saxBuilder.build(tmpDocReader);
        } catch (Exception ex) {
          throw new FeedException("Invalid XML", ex);
        }
        List children = tmpDoc.getRootElement().removeContent();
        contentElement.addContent(children);
      } else {
        // must be type html, text or some other non-XML format
        // JDOM will escape property for XML
        contentElement.addContent(content.getValue());
      }
    }
  }