Package org.jdom

Examples of org.jdom.CDATA


     * check for the expected toString text value of Comment.
     */
    public void test_TCM__String_toString() {
        {
            final String text = "this is a simple CDATA section";       
            final CDATA cdata = new CDATA(text);

            assertEquals(
                    "incorrect CDATA constructed",
                    "[CDATA: " + text + ']',
                    cdata.toString());
        }
   
        {
            final String text = "this is CDATA section with special characters as < > & &amp; &lt; &gt; [[ ]] > <![![";       
            final CDATA cdata = new CDATA(text);

            assertEquals(
                    "incorrect CDATA constructed",
                    "[CDATA: " + text + ']',
                    cdata.toString());
        }
   
    }
View Full Code Here


 
  protected void addRecipients(String[] recipients, String elementName, Element recipientsElem) {
    if (recipients!=null) {
      for (String address : recipients) {
        Element addressElem = new Element(elementName);
        addressElem.addContent(new CDATA(address));
        recipientsElem.addContent(addressElem);
      }
    }
  }
View Full Code Here

   */
  protected Element createModelElement(MessageModel model) {
    Element modelElem = new Element(MODEL_ELEM);
   
    Element subjectElem = new Element(MODEL_SUBJECT_CHILD);
    subjectElem.addContent(new CDATA(model.getSubjectModel()));
    modelElem.addContent(subjectElem);
   
    Element bodyElem = new Element(MODEL_BODY_CHILD);
    bodyElem.addContent(new CDATA(model.getBodyModel()));
    modelElem.addContent(bodyElem);
   
    return modelElem;
  }
View Full Code Here

    mailElem.setAttribute(MAIL_SENDERCODE_ATTR, config.getSenderCode());
    mailElem.setAttribute(MAIL_MAILATTRNAME_ATTR, config.getMailAttrName());
    mailElem.setAttribute(MAIL_UNSUBSCRIPTIONPAGE_ATTR, config.getUnsubscriptionPageCode());
   
    Element subject = new Element(MAIL_SUBJECT_CHILD);
    subject.addContent(new CDATA(config.getSubject()));
    mailElem.addContent(subject);
   
    Element htmlHeader = new Element(MAIL_HTML_HEADER_CHILD);
    htmlHeader.addContent(new CDATA(config.getHtmlHeader()));
    mailElem.addContent(htmlHeader);
   
    Element htmlFooter = new Element(MAIL_HTML_FOOTER_CHILD);
    htmlFooter.addContent(new CDATA(config.getHtmlFooter()));
    mailElem.addContent(htmlFooter);
   
    Element htmlSeparator = new Element(MAIL_HTML_SEPARATOR_CHILD);
    htmlSeparator.addContent(new CDATA(config.getHtmlSeparator()));
    mailElem.addContent(htmlSeparator);
   
    Element textHeader = new Element(MAIL_TEXT_HEADER_CHILD);
    textHeader.addContent(new CDATA(config.getTextHeader()));
    mailElem.addContent(textHeader);
   
    Element textFooter = new Element(MAIL_TEXT_FOOTER_CHILD);
    textFooter.addContent(new CDATA(config.getTextFooter()));
    mailElem.addContent(textFooter);
   
    Element textSeparator = new Element(MAIL_TEXT_SEPARATOR_CHILD);
    textSeparator.addContent(new CDATA(config.getTextSeparator()));
    mailElem.addContent(textSeparator);
   
   
    Element subscribersHtmlFooter = new Element(MAIL_SUBSCRIBER_HTML_FOOTER_CHILD);
    subscribersHtmlFooter.addContent(new CDATA(config.getSubscribersHtmlFooter()));
    mailElem.addContent(subscribersHtmlFooter);
   
    Element subscribersTextFooter = new Element(MAIL_SUBSCRIBER_TEXT_FOOTER_CHILD);
    subscribersTextFooter.addContent(new CDATA(config.getSubscribersTextFooter()));
    mailElem.addContent(subscribersTextFooter);
   
    Element subscriptionElem = new Element(MAIL_SUBSCRIPTION_CHILD);
    subscriptionElem.setAttribute(MAIL_SUBSCRIPTION_PAGECODE_ATTR, config.getSubscriptionPageCode());
    subscriptionElem.setAttribute(MAIL_SUBSCRIPTION_TOKENVALIDITY_ATTR, String.valueOf(config.getSubscriptionTokenValidityDays()));
   
    Element subscriptionSubject = new Element(MAIL_SUBSCRIPTION_SUBJECT_CHILD);
    subscriptionSubject.addContent(new CDATA(config.getSubscriptionSubject()));
    subscriptionElem.addContent(subscriptionSubject);
   
    Element subscriptionTextBody = new Element(MAIL_SUBSCRIPTION_HTML_CHILD);
    subscriptionTextBody.addContent(new CDATA(config.getSubscriptionHtmlBody()));
    subscriptionElem.addContent(subscriptionTextBody);
   
    Element subscriptionHtmlBody = new Element(MAIL_SUBSCRIPTION_TEXT_CHILD);
    subscriptionHtmlBody.addContent(new CDATA(config.getSubscriptionTextBody()));
    subscriptionElem.addContent(subscriptionHtmlBody);
   
    mailElem.addContent(subscriptionElem);
    return mailElem;
  }
View Full Code Here

        localhostElem.addContent(config.getLocalhost().trim());
        root.addContent(localhostElem);
      }
      if (config.getDomainName() != null && config.getDomainName().trim().length() > 0) {
        Element domainElem = new Element(DOMAIN_ELEM);
        domainElem.addContent(new CDATA(config.getDomainName()));
        root.addContent(domainElem);
      }
     
      Element certificatesElem = new Element(CERTIFICATES_ELEM);
      Element enableElem = new Element(CERTIFICATES_ENABLE_CHILD);
      enableElem.addContent(String.valueOf(config.isCertificateEnable()));
      certificatesElem.addContent(enableElem);
      Element lazyCheckElem = new Element(CERTIFICATES_LAZYCHECK_CHILD);
      lazyCheckElem.addContent(String.valueOf(config.isCertificateLazyCheck()));
      certificatesElem.addContent(lazyCheckElem);
      Element certPathElem = new Element(CERTIFICATES_CERTPATH_CHILD);
      certPathElem.addContent(new CDATA(config.getCertificatePath()));
      certificatesElem.addContent(certPathElem);
      Element debugOnConsoleElem = new Element(CERTIFICATES_DEBUGONCONSOLE_CHILD);
      debugOnConsoleElem.addContent(String.valueOf(config.isCertificateDebugOnConsole()));
      certificatesElem.addContent(debugOnConsoleElem);
      root.addContent(certificatesElem);
     
      Element imapElem = new Element(IMAP_ELEM);
      Element imapHostElem = new Element(IMAP_HOST_CHILD);
      imapHostElem.addContent(new CDATA(config.getImapHost()));
      imapElem.addContent(imapHostElem);
      Element imapProtocolElem = new Element(IMAP_PROTOCOL_CHILD);
      imapProtocolElem.addContent(config.getImapProtocol());
      imapElem.addContent(imapProtocolElem);
      Element imapPortElem = new Element(IMAP_PORT_CHILD);
      Integer imapPort = config.getImapPort();
      imapPortElem.addContent(imapPort==null ? "" : imapPort.toString());
      imapElem.addContent(imapPortElem);
      root.addContent(imapElem);
     
      Element smtpElem = new Element(SMTP_ELEM);
      smtpElem.setAttribute(SMTP_DEBUG_ATTR, String.valueOf(config.isDebug()));
      smtpElem.setAttribute(SMTP_JAPS_USER_AUTH_ATTR, String.valueOf(config.isSmtpJapsUserAuth()));
      Element smtpHostElem = new Element(IMAP_HOST_CHILD);
      smtpHostElem.addContent(new CDATA(config.getSmtpHost()));
      smtpElem.addContent(smtpHostElem);
      Element smtpUserElem = new Element(SMTP_USER_CHILD);
      smtpUserElem.addContent(config.getSmtpUserName());
      smtpElem.addContent(smtpUserElem);
      Element smtpPasswordElem = new Element(SMTP_PASSWORD_CHILD);
View Full Code Here

      Template template = current.getValue();
     
      templateElement.setAttribute(TEMPLATE_LANG_ATTR, current.getKey());
     
      Element subjectElem = new Element(TEMPLATE_SUBJECT_CHILD);
      subjectElem.addContent(new CDATA(template.getSubject()));
      templateElement.addContent(subjectElem);
     
      Element bodyElem = new Element(TEMPLATE_BODY_CHILD);
      bodyElem.addContent(new CDATA(template.getBody()));
      templateElement.addContent(bodyElem);
     
      parent.addContent(templateElement);
    }
  }
View Full Code Here

    mailElem.setAttribute(MAIL_SENDERCODE_ATTR, config.getSenderCode());
    mailElem.setAttribute(MAIL_MAILATTRNAME_ATTR, config.getMailAttrName());
    mailElem.setAttribute(MAIL_HTML_ATTR, String.valueOf(config.isHtml()));

    Element subject = new Element(MAIL_SUBJECT_CHILD);
    subject.addContent(new CDATA(config.getSubject()));
    mailElem.addContent(subject);

    Element htmlHeader = new Element(MAIL_HEADER_CHILD);
    htmlHeader.addContent(new CDATA(config.getHeader()));
    mailElem.addContent(htmlHeader);

    Element htmlFooter = new Element(MAIL_FOOTER_CHILD);
    htmlFooter.addContent(new CDATA(config.getFooter()));
    mailElem.addContent(htmlFooter);

    Element templateInsert = new Element(MAIL_TEMPLATE_INSERT_CHILD);
    templateInsert.addContent(new CDATA(config.getTemplateInsert()));
    mailElem.addContent(templateInsert);

    Element templateUpdate = new Element(MAIL_TEMPLATE_UPDATE_CHILD);
    templateUpdate.addContent(new CDATA(config.getTemplateUpdate()));
    mailElem.addContent(templateUpdate);

    if (config.isNotifyRemove()) {
      Element templateRemove = new Element(MAIL_TEMPLATE_REMOVE_CHILD);
      templateRemove.addContent(new CDATA(config.getTemplateRemove()));
      mailElem.addContent(templateRemove);
    }

    return mailElem;
  }
View Full Code Here

    mailElement.setAttribute(MAIL_SENDERCODE_ATTR, notifierConfig.getSenderCode());
    //mailElement.setAttribute(MAIL_MAILATTRNAME_ATTR, notifierConfig.getMailAttrName());
    mailElement.setAttribute(MAIL_HTML_ATTR, String.valueOf(notifierConfig.isHtml()));
   
    Element subjectElement = new Element(MAIL_SUBJECT_CHILD);
    subjectElement.addContent(new CDATA(notifierConfig.getSubject()));
    mailElement.addContent(subjectElement);
   
    Element headerElement = new Element(MAIL_HEADER_CHILD);
    headerElement.addContent(new CDATA(notifierConfig.getHeader()));
    mailElement.addContent(headerElement);
   
    Element templateElement = new Element(MAIL_TEMPLATE_CHILD);
    templateElement.addContent(new CDATA(notifierConfig.getTemplate()));
    mailElement.addContent(templateElement);
   
    Element footerElement = new Element(MAIL_FOOTER_CHILD);
    footerElement.addContent(new CDATA(notifierConfig.getFooter()));
    mailElement.addContent(footerElement);
   
    return mailElement;
  }
View Full Code Here

TOP

Related Classes of org.jdom.CDATA

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.