Package org.jdom

Examples of org.jdom.CDATA


                    Document d =
                        new SAXBuilder().build( new StringReader(objectLockToken.getOwnerInfo()) );
                    owner.addContent(d.detachRootElement());
                }
                catch( Throwable e ) {
                    owner.addContent(new CDATA(objectLockToken.getOwnerInfo()));
                }
            }
           
            Element timeout = new Element(E_TIMEOUT, DNSP);
            activelock.addContent(timeout);
View Full Code Here


     * this method prints the XML request body attribute.
     */
    private Element printXMLrequestBody(){
        Element bodyElem = new Element( "body" );
        try {
            bodyElem.addContent( new CDATA(request.getRequestBody()) );
        }
        catch (IOException e) {
            e.printStackTrace();
        }
        return bodyElem;
View Full Code Here

     * this method prints the XML response body attribute.
     */
    private Element printXMLresponseBody() {
        Element bodyElem = new Element( "body" );
        try {
            bodyElem.addContent( new CDATA(response.getResponseBody()) );
        } catch ( IOException e ) {
            e.printStackTrace();
        }
        return bodyElem;
    }
View Full Code Here

                    Document d =
                        new SAXBuilder().build( new StringReader(objectLockToken.getOwnerInfo()) );
                    owner.addContent(d.getRootElement());
                }
                catch( Throwable e ) {
                    owner.addContent(new CDATA(objectLockToken.getOwnerInfo()));
                }
            }
           
            Element timeout = new Element(E_TIMEOUT, DNSP);
            activelock.addContent(timeout);
View Full Code Here

            Comment c = (Comment) i.next();
            c.setText( ReleaseUtil.normalizeLineEndings( c.getText(), ls ) );
        }
        for ( Iterator i = document.getDescendants( new ContentFilter( ContentFilter.CDATA ) ); i.hasNext(); )
        {
            CDATA c = (CDATA) i.next();
            c.setText( ReleaseUtil.normalizeLineEndings( c.getText(), ls ) );
        }
    }
View Full Code Here

      Element schoolNode = new Element(SCHOOL_ELEMENT);
      for(String attr : SCHOOL_ATTRS) {
        Element attrNode = new Element(attr);
        if(SCHOOL_ATTR_ID.equals(attr)) {
          //attrNode.setContent(school.getId() != null ? this.createCData(school.getId().toString()) : "");
          attrNode.setContent(mediationService.getId() != null && school.getId() != null ? new CDATA(new StringBuffer(String.valueOf(mediationService.getId())).append("-").append(String.valueOf(school.getId())).toString()) : new CDATA(""));
        } else if(SCHOOL_ATTR_NAME.equals(attr)) {
          attrNode.setContent(school.getName() != null ? new CDATA(school.getName()) : new CDATA(""));
        } else if(SCHOOL_ATTR_PHONE.equals(attr)) {
          attrNode.addContent(school.getContactInfo() != null && school.getContactInfo().getTelephone() != null ?
              new CDATA(school.getContactInfo().getTelephone()) : new CDATA(""));
        } else if(SCHOOL_ATTR_FAX.equals(attr)) {
          attrNode.addContent(school.getContactInfo() != null &&school.getContactInfo().getFax() != null ?
              new CDATA(school.getContactInfo().getFax()) : new CDATA(""));
        } else if(SCHOOL_ATTR_MAIL.equals(attr)) {
          attrNode.addContent(school.getContactInfo() != null && school.getContactInfo().getEmail() != null ?
              new CDATA(school.getContactInfo().getEmail()) : new CDATA(""));
        } else if(SCHOOL_ATTR_ADDR.equals(attr)) {
          attrNode.addContent(school.getContactInfo() != null && school.getContactInfo().getStreetAddress() != null ?
              new CDATA(school.getContactInfo().getStreetAddress()) : new CDATA(""));
        } else if(SCHOOL_ATTR_PK.equals(attr)) {
          attrNode.addContent(school.getContactInfo() != null && school.getContactInfo().getZipCode() != null ?
              new CDATA(school.getContactInfo().getZipCode()) : new CDATA(""));
        } else if(SCHOOL_ATTR_WEB.equals(attr)) {
          attrNode.addContent(school.getContactInfo() != null && school.getContactInfo().getWebSite() != null ?
              new CDATA(school.getContactInfo().getWebSite()) : new CDATA(""));
        } else if(SCHOOL_ATTR_CITY.equals(attr)) {
          attrNode.addContent(school.getContactInfo() != null && school.getContactInfo().getCity() != null ?
              new CDATA(school.getContactInfo().getCity()) : new CDATA(""));
        } else if(SCHOOL_ATTR_FEED.equals(attr)) {         
          StringBuffer sb = new StringBuffer(contextPath).append("/").append(locale).append(COURSES_FEED).append(provider.getId()).append("/").append(school.getId());
          attrNode.addContent(new CDATA(sb.toString()));
        }
        schoolNode.addContent(attrNode);
      }
     
      root.addContent(schoolNode);
View Full Code Here

     
      // Make course node element with i18n properties
      Element courseNode = new Element(COURSE_ELEMENT);
      for(String attr : COURSE_ATTRS) {
        if(COURSE_ATTR_ID.equals(attr)) {
          courseNode.setContent(new Element(attr).addContent(mediationService.getId() != null && course.getId() != null ? new CDATA(new StringBuffer(String.valueOf(mediationService.getId())).append("-").append(String.valueOf(course.getId())).toString()) : new CDATA("")));
        } else if(COURSE_ATTR_NAME.equals(attr)) { // I18nProperty
          Iterator<String> it = i18nCourse.keySet().iterator();
          while(it.hasNext()) {
            String language = it.next();
            String i18nAttr = new StringBuffer(attr).append(language).toString();
            ExtendedCourse c = i18nCourse.get(language);
            courseNode.addContent(new Element(i18nAttr).setContent(c.getTitle() != null ? new CDATA(c.getTitle()) : new CDATA("")));
          }
        } else if(COURSE_ATTR_URL.equals(attr)) { // I18nProperty // TODO may be better a function...
          Iterator<String> it = i18nCourse.keySet().iterator();
          while(it.hasNext()) {
            String language = it.next();
            String i18nAttr = new StringBuffer(attr).append(language).toString();
            ExtendedCourse c = i18nCourse.get(language);
            String url = new StringBuffer(contextPath).append("/").append(language).append(COURSE_DETAIL_URL).append(course.getId()).toString();
            courseNode.addContent(new Element(i18nAttr).setContent(new CDATA(url)));
          }
        } else if(COURSE_ATTR_START.equals(attr)) {
          courseNode.addContent(new Element(attr).setContent(course.getStart() != null ? new CDATA(dateFormat.format(course.getStart())) : new CDATA("")));
        } else if(COURSE_ATTR_END.equals(attr)) {
          courseNode.addContent(new Element(attr).setContent(course.getEnd() != null ? new CDATA(dateFormat.format(course.getEnd())) : new CDATA("")));
        } else if(COURSE_ATTR_INFO.equals(attr)) { // I18nProperty // TODO may be better a function...
          Iterator<String> it = i18nCourse.keySet().iterator();
          while(it.hasNext()) {
            String language = it.next();
            String i18nAttr = new StringBuffer(attr).append(language).toString();
            ExtendedCourse c = i18nCourse.get(language);
            courseNode.addContent(new Element(i18nAttr).setContent(c.getInformation() != null ? new CDATA(c.getInformation().getValue()) : new CDATA("")));
          }
        } else if(COURSE_ATTR_GAIAK.equals(attr)) {
          Element tagsNode = new Element(attr);
          for(Category category : course.getTags()) {
            Element tagNode = new Element(COURSE_ATTR_GAIA);
            for(String gaiaAttr : GAIA_ATTRS) {
              Element tagAttrNode = new Element(gaiaAttr);
              if(GAIA_ATTR_ID.equals(gaiaAttr)) {
                tagAttrNode.setText("");
              } else if(GAIA_ATTR_NAME.equals(gaiaAttr)) {
                tagAttrNode.setContent(new CDATA(category.getCategory()));
              }
              tagNode.addContent(tagAttrNode);
            }
            tagsNode.addContent(tagNode);
          }
View Full Code Here

                    && !line.startsWith("\t")) {
                makeNewCurrentElement(line.substring(0, line.lastIndexOf(':')));
                return; // Do not log the goal itself
            }
            Element msg = new Element("message");
            msg.addContent(new CDATA(line));
            // Initially call it "info" level.
            // If "the going gets tough" we'll switch this to "error"
            msg.setAttribute("priority", "info");
            if (currentElement == null) {
                buildLogElement.addContent(msg);
View Full Code Here

        dateElement.addContent(formatter.format(modifiedTime));
        Element userElement = new Element(TAGNAME_USER);
        userElement.addContent(userName);
        Element commentElement = new Element(TAGNAME_COMMENT);

        CDATA cd = null;
        try {
            cd = new CDATA(comment);
        } catch (org.jdom.IllegalDataException e) {
            LOG.error(e);
            cd =
                new CDATA("Unable to parse comment.  It contains illegal data.");
        }
        commentElement.addContent(cd);

        modificationElement.addContent(filenameElement);
        modificationElement.addContent(projectElement);
View Full Code Here

            if (emailAddress != null) {
                changelistElement.setAttribute("email", emailAddress);
            }
            changelistElement.setAttribute("dateOfSubmission", dateOfSubmission);
            Element descriptionElement = new Element("description");
            descriptionElement.addContent(new CDATA(description));
            changelistElement.addContent(descriptionElement);
            for (int i = 0; i < affectedFiles.size(); i++) {
                AffectedFile affectedFile = (AffectedFile) affectedFiles.elementAt(i);
                changelistElement.addContent(affectedFile.toElement());
            }
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.