Example usage for org.jdom2 Element Element

List of usage examples for org.jdom2 Element Element

Introduction

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

Prototype

public Element(final String name) 

Source Link

Document

Create a new element with the supplied (local) name and no namespace.

Usage

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);// www . j a  v a  2  s  .  c o  m
    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 {// 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.Annotation.java

License:Open Source License

public Annotation() {
    super(new Element(TAG_NAME));
}

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

License:Open Source License

public Bio4jNodeIndexXML() {
    super(new Element(TAG_NAME));
}

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

License:Open Source License

public Bio4jNodeXML() {
    super(new Element(TAG_NAME));
}

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

License:Open Source License

private Element initIncomingRelationshipsTag() {
    Element elem = root.getChild(INCOMING_RELATIONSHIPS_TAG_NAME);
    if (elem == null) {
        elem = new Element(INCOMING_RELATIONSHIPS_TAG_NAME);
        root.addContent(elem);/*from   w  w w  .  j a  v  a 2s .co m*/
    }
    return elem;
}

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

License:Open Source License

private Element initOutgoingRelationshipsTag() {
    Element elem = root.getChild(OUTGOING_RELATIONSHIPS_TAG_NAME);
    if (elem == null) {
        elem = new Element(OUTGOING_RELATIONSHIPS_TAG_NAME);
        root.addContent(elem);//from w ww . j  a  va2  s  . co m
    }
    return elem;
}

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

License:Open Source License

private Element initIndexesTag() {
    Element elem = root.getChild(INDEXES_TAG_NAME);
    if (elem == null) {
        elem = new Element(INDEXES_TAG_NAME);
        root.addContent(elem);//from   w  ww  . j a  v a2  s  .  c  o  m
    }
    return elem;
}

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

License:Open Source License

private Element initPropertiesTag() {
    Element elem = root.getChild(PROPERTIES_TAG_NAME);
    if (elem == null) {
        elem = new Element(PROPERTIES_TAG_NAME);
        root.addContent(elem);/*from w  w w  . j av a 2  s. c  o  m*/
    }
    return elem;
}

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

License:Open Source License

public Bio4jPropertyXML() {
    super(new Element(TAG_NAME));
}