Example usage for org.dom4j Document addElement

List of usage examples for org.dom4j Document addElement

Introduction

In this page you can find the example usage for org.dom4j Document addElement.

Prototype

Element addElement(String name);

Source Link

Document

Adds a new Element node with the given name to this branch and returns a reference to the new node.

Usage

From source file:com.pureinfo.srm.project.action.CardIdGenerateAction.java

License:Open Source License

/**
 * @return/*from  www  .ja va2  s  . c o m*/
 */
private Document makeResponseXML() {
    Document doc = DocumentHelper.createDocument();
    Element xRoot = doc.addElement("responseXML");
    Element xValue = xRoot.addElement("value");
    xValue.setText(m_sCardId);
    Element xMSG = xRoot.addElement("msg");
    xMSG.setText(m_sMessage);
    return doc;
}

From source file:com.pureinfo.srm.reports.table.data.institute.InstituteQueryAction.java

License:Open Source License

private Document makeXML(List _sListIns) {
    Document doc = DocumentHelper.createDocument();
    Element xRoot = doc.addElement("datas");
    Element inses = xRoot.addElement("inses");
    for (Iterator iter = _sListIns.iterator(); iter.hasNext();) {
        Organization org = (Organization) iter.next();
        int id = org.getId();
        String sName = org.getName();
        Element xIns = inses.addElement("ins");
        xIns.addAttribute("id", Integer.toString(id));
        xIns.addAttribute("name", sName);
        xIns.addAttribute("code", org.getCode());
    }/*from  w  ww .  j a  va2s . c  o m*/
    return doc;
}

From source file:com.pureinfo.srm.weight.action.QueryWeightConfigAction.java

License:Open Source License

/**
 * @see com.pureinfo.ark.interaction.ActionBase#executeAction()
 *//*from www  .  jav a 2 s .c  om*/
public ActionForward executeAction() throws PureException {
    int year = request.getRequiredInt("weightYear", "weight year");
    IWeightConfigMgr mgr = (IWeightConfigMgr) ArkContentHelper.getContentMgrOf(SRMTypes.WEIGHTCONFIG);
    boolean bExist = mgr.checkWeightExist(year);
    StringBuffer sbuff = new StringBuffer();
    sbuff.append("<select id=\"id_isViewProbWeight\" name=\"isViewProbWeight\">");
    sbuff.append("<option value=\"1\"></option>");
    if (bExist) {
        sbuff.append("<option value=\"0\"></option>");
    }
    sbuff.append("</select>");

    try {
        Document document = DocumentHelper.createDocument();
        Element element = document.addElement("result");
        element.setText(sbuff.toString());

        response.setCharacterEncoding("utf-8");
        response.setContentType("text/xml");
        response.setHeader("Cache-Control", "no-cache"); // HTTP 1.1
        response.setHeader("Pragma", "no-cache"); // HTTP 1.0

        response.getWriter().write(sbuff.toString());

    } catch (IOException ex1) {
        ex1.printStackTrace(System.err);
    } finally {
        sbuff.setLength(0);
    }

    return null;
}

From source file:com.rayo.core.xml.providers.ColibriProvider.java

License:Apache License

private void createColibriOfferEvent(ColibriOfferEvent event, Document document) {
    Element root = document.addElement(new QName("offer", NAMESPACE));
    root.addAttribute("muc", event.getMuc().toString());
    root.addAttribute("videobridge", event.getMuc().getNode());
    root.addAttribute("nickname", event.getNickname());
    root.addAttribute("participant", event.getParticipant().toString());
    root.add(event.getConference().createCopy());
}

From source file:com.rayo.core.xml.providers.ColibriProvider.java

License:Apache License

private void createAddSourceEvent(AddSourceEvent event, Document document) {
    Element root = document.addElement(new QName("addsource", NAMESPACE));
    root.addAttribute("muc", event.getMuc().toString());
    root.addAttribute("videobridge", event.getMuc().getNode());
    root.addAttribute("nickname", event.getNickname());
    root.addAttribute("participant", event.getParticipant().toString());
    root.add(event.getConference().createCopy());
}

From source file:com.rayo.core.xml.providers.ColibriProvider.java

License:Apache License

private void createRemoveSourceEvent(RemoveSourceEvent event, Document document) {
    Element root = document.addElement(new QName("removesource", NAMESPACE));
    root.addAttribute("muc", event.getMuc().toString());
    root.addAttribute("videobridge", event.getMuc().getNode());
    root.addAttribute("nickname", event.getNickname());
    root.addAttribute("participant", event.getParticipant().toString());
    root.addAttribute("active", event.isActive() ? "true" : "false");
    root.add(event.getConference().createCopy());
}

From source file:com.rayo.core.xml.providers.ColibriProvider.java

License:Apache License

private void createJoinBridgeEvent(JoinBridgeEvent joined, Document document) {
    Element root = document.addElement(new QName("joined", NAMESPACE));
    root.addAttribute("mixer-name", joined.getMixer());
    root.addAttribute("nickname", joined.getNickname());
    root.addAttribute("participant", joined.getParticipant().toString());
}

From source file:com.rayo.core.xml.providers.ColibriProvider.java

License:Apache License

private void createLeaveBridgeEvent(LeaveBridgeEvent unjoined, Document document) {
    Element root = document.addElement(new QName("unjoined", NAMESPACE));
    root.addAttribute("mixer-name", unjoined.getMixer());
    root.addAttribute("nickname", unjoined.getNickname());
    root.addAttribute("participant", unjoined.getParticipant().toString());
}

From source file:com.rayo.core.xml.providers.ColibriProvider.java

License:Apache License

private void createMutedEvent(MutedEvent muted, Document document) {
    document.addElement(new QName("onmute", NAMESPACE));
}

From source file:com.rayo.core.xml.providers.ColibriProvider.java

License:Apache License

private void createUnmutedEvent(UnmutedEvent unmuted, Document document) {
    document.addElement(new QName("offmute", NAMESPACE));
}