Example usage for org.jdom2 Element addContent

List of usage examples for org.jdom2 Element addContent

Introduction

In this page you can find the example usage for org.jdom2 Element addContent.

Prototype

@Override
public Element addContent(final Collection<? extends Content> newContent) 

Source Link

Document

Appends all children in the given collection to the end of the content list.

Usage

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 {//from  ww  w  .  ja  va  2  s .  c  o m
        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.bio4j.Bio4jNodeXML.java

License:Open Source License

public void addIncomingRelationship(Bio4jRelationshipXML rel) {
    Element elem = initIncomingRelationshipsTag();
    elem.addContent(rel.getRoot());
}

From source file:com.ohnosequences.xml.model.bio4j.Bio4jNodeXML.java

License:Open Source License

public void addOutgoingRelationship(Bio4jRelationshipXML rel) {
    Element elem = initOutgoingRelationshipsTag();
    elem.addContent(rel.getRoot());
}

From source file:com.ohnosequences.xml.model.bio4j.Bio4jNodeXML.java

License:Open Source License

public void addIndex(Bio4jNodeIndexXML index) {
    Element elem = initIndexesTag();
    elem.addContent(index.getRoot());
}

From source file:com.ohnosequences.xml.model.bio4j.Bio4jNodeXML.java

License:Open Source License

public void addProperty(Bio4jPropertyXML property) {
    Element elem = initPropertiesTag();
    elem.addContent(property.getRoot());
}

From source file:com.ohnosequences.xml.model.bio4j.Bio4jRelationshipXML.java

License:Open Source License

public void addStartNode(Bio4jNodeXML node) {
    Element elem = initStartNodesTag();
    elem.addContent(node.getRoot());
}

From source file:com.ohnosequences.xml.model.bio4j.Bio4jRelationshipXML.java

License:Open Source License

public void addEndNode(Bio4jNodeXML node) {
    Element elem = initEndNodesTag();
    elem.addContent(node.getRoot());
}

From source file:com.ohnosequences.xml.model.bio4j.Bio4jRelationshipXML.java

License:Open Source License

public void addIndex(Bio4jRelationshipIndexXML index) {
    Element elem = initIndexesTag();
    elem.addContent(index.getRoot());
}

From source file:com.ohnosequences.xml.model.ContigXML.java

License:Open Source License

public void addHsp(Hsp hsp) {
    initHspsTag();
    Element hsps = root.getChild(HSPS_TAG_NAME);
    hsps.addContent(hsp.asJDomElement());
}

From source file:com.ohnosequences.xml.model.genome.feature.Feature.java

License:Open Source License

public void setOddAxisPalindromicityResult(PalindromicityResultXML result) {
    root.removeChildren(ODD_AXIS_PALINDROMICITY_TAG_NAME);
    Element elem = new Element(ODD_AXIS_PALINDROMICITY_TAG_NAME);
    elem.addContent(result.getRoot());
    root.addContent(elem);/* w w w.  j  av a2 s . com*/
}