Package org.dom4j

Examples of org.dom4j.Element


     * @param reason       reason for the destruction or <tt>null</tt> if none.
     */
    public DestroyRoom(JID alternateJID, String reason) {
        super();
        setType(Type.set);
        Element query = setChildElement("query", "http://jabber.org/protocol/muc#owner");
        Element destroy = query.addElement("destroy");
        if (alternateJID != null) {
            destroy.addAttribute("jid", alternateJID.toString());
        }
        if (reason != null) {
            destroy.addElement("reason").setText(reason);
        }
    }
View Full Code Here


     * @param fieldValues the list of fields associated with the list of values.
     */
    public RoomConfiguration(Map<String,Collection<String>> fieldValues) {
        super();
        setType(Type.set);
        Element query = setChildElement("query", "http://jabber.org/protocol/muc#owner");
        Element form = query.addElement("x", "jabber:x:data");
        form.addAttribute("type", "submit");
        // Add static field
        Element field = form.addElement("field");
        field.addAttribute("var", "FORM_TYPE");
        field.addElement("value").setText("http://jabber.org/protocol/muc#roomconfig");
        // Add the specified fields and their corresponding values
        for (String variable : fieldValues.keySet()) {
            field = form.addElement("field");
            field.addAttribute("var", variable);
            for (String value : fieldValues.get(variable)) {
                field.addElement("value").setText(value);
            }
        }
    }
View Full Code Here

     *        address.
     * @param reason the reason why the invitation is being sent.
     */
    public Invitation(String invitee, String reason) {
        super();
        Element element = addChildElement("x", "http://jabber.org/protocol/muc#user");
        Element invite = element.addElement("invite");
        invite.addAttribute("to", invitee);
        if (reason != null && reason.length() > 0) {
            invite.addElement("reason").setText(reason);
        }
    }
View Full Code Here

    }

    @PostConstruct
    public void init() throws Exception {
        InputStream in = getResource(servletContext, menuPath);
        Element root = Dom4JUtils.parse(in).getRootElement();
        menuBar = new MenuBar();
        for (Object menu : root.elements("menu")) menuBar.addMenu(buildMenu((Element) menu));
    }
View Full Code Here

    return NodeType.ENTITY_REFERENCE_NODE;
  }

  public String getPath(Element context) {
    // From XPaths perspective, entities are included in text
    Element parent = getParent();

    return ((parent != null) && (parent != context)) ? (parent
        .getPath(context) + "/text()") : "text()";
  }
View Full Code Here

        .getPath(context) + "/text()") : "text()";
  }

  public String getUniquePath(Element context) {
    // From XPaths perspective, entities are included in text
    Element parent = getParent();

    return ((parent != null) && (parent != context)) ? (parent
        .getUniquePath(context) + "/text()") : "text()";
  }
View Full Code Here

  public XMLErrorHandler(Element errors) {
    this.errors = errors;
  }

  public void error(SAXParseException e) {
    Element element = errors.addElement(errorQName);
    addException(element, e);
  }
View Full Code Here

    Element element = errors.addElement(errorQName);
    addException(element, e);
  }

  public void fatalError(SAXParseException e) {
    Element element = errors.addElement(fatalErrorQName);
    addException(element, e);
  }
View Full Code Here

    Element element = errors.addElement(fatalErrorQName);
    addException(element, e);
  }

  public void warning(SAXParseException e) {
    Element element = errors.addElement(warningQName);
    addException(element, e);
  }
View Full Code Here

  protected Object getCopyOfUserData() {
    return data;
  }

  protected Element createElement(String name) {
    Element answer = getDocumentFactory().createElement(name);
    answer.setData(getCopyOfUserData());

    return answer;
  }
View Full Code Here

TOP

Related Classes of org.dom4j.Element

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.