code: public static Element getAttachementElement(Attachment att) {
  
      Element attachment = new Element(ATTACHEMENT_ELEMENT);
  
      if (null != att.getAlternateId() && att.getAlternateId().length() > 0) {
        Element e = new Element(ATTACHEMENT_ID_ELEMENT);
        e.setText(att.getAlternateId());
        attachment.getChildren().add(e);
      }
  
      if (null != att.getLabel() && att.getLabel().length() > 0) {
        Element e = new Element(ATTACHEMENT_LABEL_ELEMENT);
        e.setText(att.getLabel());
        attachment.getChildren().add(e);
      }
  
      if (null != att.getCapGroupName() && att.getCapGroupName().length() > 0) {
        Element e = new Element(CAP_GROUP_NAME_ELEMENT);
        e.setText(att.getCapGroupName());
        attachment.getChildren().add(e);
      }
  
      if (null != att.getCapGroupSMILES()
          && att.getCapGroupSMILES().length() > 0) {
        Element e = new Element(CAP_GROUP_SMILES_ELEMENT);
        e.setText(att.getCapGroupSMILES());
        attachment.getChildren().add(e);
      }
  
      return attachment;
    }
docs: This method converts Attachment to ATTACHMENT XML element
  
  @param att -- Attachment
  @return Element