List of usage examples for org.jdom2 Element setText
public Element setText(final String text)
From source file:com.novell.ldapchai.cr.ChaiHelpdeskAnswer.java
License:Open Source License
public Element toXml() throws ChaiOperationException { final Element answerElement = new Element(ChaiResponseSet.XML_NODE_ANSWER_VALUE); answerElement.setText(encryptValue(answer, challengeText)); answerElement.setAttribute(ChaiResponseSet.XML_ATTRIBUTE_CONTENT_FORMAT, FormatType.HELPDESK.toString()); return answerElement; }
From source file:com.novell.ldapchai.cr.HashSaltAnswer.java
License:Open Source License
public Element toXml() { final Element answerElement = new Element(ChaiResponseSet.XML_NODE_ANSWER_VALUE); answerElement.setText(version.toString() + VERSION_SEPARATOR + answerHash); if (salt != null && salt.length() > 0) { answerElement.setAttribute(ChaiResponseSet.XML_ATTRIBUTE_SALT, salt); }//from w ww.ja va 2s .com answerElement.setAttribute(ChaiResponseSet.XML_ATTRIBUTE_CONTENT_FORMAT, formatType.toString()); if (hashCount > 1) { answerElement.setAttribute(ChaiResponseSet.XML_ATTRIBUTE_HASH_COUNT, String.valueOf(hashCount)); } return answerElement; }
From source file:com.novell.ldapchai.cr.TextAnswer.java
License:Open Source License
public Element toXml() { final Element answerElement = new Element(ChaiResponseSet.XML_NODE_ANSWER_VALUE); answerElement.setText(answer); answerElement.setAttribute(ChaiResponseSet.XML_ATTRIBUTE_CONTENT_FORMAT, FormatType.TEXT.toString()); return answerElement; }
From source file:com.novell.ldapchai.impl.edir.NmasResponseSet.java
License:Open Source License
static String csToNmasXML(final ChallengeSet cs, final String guidValue) { final Element rootElement = new Element(NMAS_XML_ROOTNODE); rootElement.setAttribute(NMAS_XML_ATTR_RANDOM_COUNT, String.valueOf(cs.getMinRandomRequired())); if (guidValue != null) { rootElement.setAttribute("GUID", guidValue); } else {// w ww.j a v a2s .com rootElement.setAttribute("GUID", "0"); } for (final Challenge challenge : cs.getChallenges()) { final Element loopElement = new Element(NMAS_XML_NODE_CHALLENGE); if (challenge.getChallengeText() != null) { loopElement.setText(challenge.getChallengeText()); } if (challenge.isAdminDefined()) { loopElement.setAttribute(NMAS_XML_ATTR_DEFINE, "Admin"); } else { loopElement.setAttribute(NMAS_XML_ATTR_DEFINE, "User"); } if (challenge.isRequired()) { loopElement.setAttribute(NMAS_XML_ATTR_TYPE, "Required"); } else { loopElement.setAttribute(NMAS_XML_ATTR_TYPE, "Random"); } loopElement.setAttribute(NMAS_XML_ATTR_MIN_LENGTH, String.valueOf(challenge.getMinLength())); loopElement.setAttribute(NMAS_XML_ATTR_MAX_LENGTH, String.valueOf(challenge.getMaxLength())); rootElement.addContent(loopElement); } final XMLOutputter outputter = new XMLOutputter(); final Format format = Format.getRawFormat(); format.setTextMode(Format.TextMode.PRESERVE); format.setLineSeparator(""); outputter.setFormat(format); return outputter.outputString(rootElement); }
From source file:com.ohnosequences.xml.model.genome.feature.Feature.java
License:Open Source License
public void appendToSequence(String value) { Element seqElem = root.getChild(SEQUENCE_TAG_NAME); if (seqElem == null) { root.addContent(new Element(SEQUENCE_TAG_NAME)); seqElem = root.getChild(SEQUENCE_TAG_NAME); }//from ww w.ja va 2s .c o m seqElem.setText(seqElem.getText() + value); }
From source file:com.rometools.modules.cc.io.CCModuleGenerator.java
License:Open Source License
private void generateRSS2(final CreativeCommons module, final Element element) { final License[] licenses = module.getLicenses(); for (int i = 0; licenses != null && i < licenses.length; i++) { final Element license = new Element("license", RSS2); license.setText(licenses[i].getValue()); element.addContent(license);//from w ww . j a va2 s . c o m } }
From source file:com.rometools.opml.io.impl.OPML20Generator.java
License:Apache License
@Override protected Element generateHead(final Opml opml) { final Element docsElement = new Element("docs"); docsElement.setText(opml.getDocs()); final Element headElement = super.generateHead(opml); headElement.addContent(docsElement); return headElement; }
From source file:com.rometools.propono.atom.common.Collection.java
License:Apache License
/** * Serialize an AtomService.Collection into an XML element *//* w w w .j a va 2 s . co m*/ public Element collectionToElement() { final Collection collection = this; final Element element = new Element("collection", AtomService.ATOM_PROTOCOL); element.setAttribute("href", collection.getHref()); final Element titleElem = new Element("title", AtomService.ATOM_FORMAT); titleElem.setText(collection.getTitle()); if (collection.getTitleType() != null && !collection.getTitleType().equals("TEXT")) { titleElem.setAttribute("type", collection.getTitleType(), AtomService.ATOM_FORMAT); } element.addContent(titleElem); // Loop to create <app:categories> elements for (final Object element2 : collection.getCategories()) { final Categories cats = (Categories) element2; element.addContent(cats.categoriesToElement()); } for (final Object element2 : collection.getAccepts()) { final String range = (String) element2; final Element acceptElem = new Element("accept", AtomService.ATOM_PROTOCOL); acceptElem.setText(range); element.addContent(acceptElem); } return element; }
From source file:com.rometools.propono.atom.common.Workspace.java
License:Apache License
/** * Serialize an AtomService.DefaultWorkspace object into an XML element */// ww w. jav a2 s . c o m public Element workspaceToElement() { final Workspace space = this; final Element element = new Element("workspace", AtomService.ATOM_PROTOCOL); final Element titleElem = new Element("title", AtomService.ATOM_FORMAT); titleElem.setText(space.getTitle()); if (space.getTitleType() != null && !space.getTitleType().equals("TEXT")) { titleElem.setAttribute("type", space.getTitleType(), AtomService.ATOM_FORMAT); } element.addContent(titleElem); for (final Collection col : space.getCollections()) { element.addContent(col.collectionToElement()); } return element; }
From source file:com.tactfactory.harmony.platform.winphone.updater.XmlProjectWinphone.java
License:Open Source License
public void addApplicationDefinitionFile(String filename) { final Element newNode = new Element(XML_ELEMENT_APPLICATION); newNode.setAttribute(XML_ATTRIBUT_INCLUDE, filename); Element subtype = new Element(XML_ELEMENT_SUBTYPE); subtype.setText(XML_CONTENT_DESIGNER); Element generator = new Element(XML_ELEMENT_GENERATOR); generator.setText(XML_CONTENT_MSBUILD_COMPILE); newNode.addContent(subtype);/*from ww w . j a v a2s . c om*/ newNode.addContent(generator); Element itemGroup = this.findFirstItemGroup(XML_ELEMENT_APPLICATION); this.removeIfExists(itemGroup, XML_ELEMENT_APPLICATION, filename); itemGroup.addContent(newNode); }