Package org.dom4j

Examples of org.dom4j.Element.addAttribute()


    users.addAttribute("allowanonymous", "true");
    Element designer = users.addElement("user");
    designer.addAttribute("name", "designer");
    designer.addAttribute("password", "wga");
    designer.addAttribute("mail", "designer@example.com");
    designer.addAttribute("aliases", "");
    Element managers = users.addElement("group");
    managers.addAttribute("name", "managers");
    managers.addAttribute("members", "designer");

    XMLWriter writer = null;
View Full Code Here


    designer.addAttribute("name", "designer");
    designer.addAttribute("password", "wga");
    designer.addAttribute("mail", "designer@example.com");
    designer.addAttribute("aliases", "");
    Element managers = users.addElement("group");
    managers.addAttribute("name", "managers");
    managers.addAttribute("members", "designer");

    XMLWriter writer = null;
    try {
      writer = new XMLWriter(OutputFormat.createPrettyPrint());
View Full Code Here

    designer.addAttribute("password", "wga");
    designer.addAttribute("mail", "designer@example.com");
    designer.addAttribute("aliases", "");
    Element managers = users.addElement("group");
    managers.addAttribute("name", "managers");
    managers.addAttribute("members", "designer");

    XMLWriter writer = null;
    try {
      writer = new XMLWriter(OutputFormat.createPrettyPrint());
      writer.setOutputStream(new FileOutputStream(new File(getWGABase().getLocation().toFile(), "auth.xml")));
View Full Code Here

    SAXReader saxReader = new SAXReader();
    try {
      File dirlinkFile = new File(dirlink.getLocationURI().getPath());
      Document document = saxReader.read(dirlinkFile);
      Element ele = (Element)document.selectSingleNode("/dirlink/path");    //TODO use statics
      ele.addAttribute("location", linkTarget);                //TODO use statics
        XMLWriter output = new XMLWriter(new FileWriter(dirlinkFile));
        try {
          output.write( document );
        } finally {
          try {
View Full Code Here

            String prefix = m_unmarshalContext.getAttributePrefix(i);
            String uri = m_unmarshalContext.getAttributeNamespace(i);
            String name = m_unmarshalContext.getAttributeName(i);
            String value = m_unmarshalContext.getAttributeValue(i);
            qname = QName.get(name, prefix, uri);
            element.addAttribute(qname, value);
        }
       
        // add all content to element
        int event = m_unmarshalContext.nextToken();
        if (event != IXMLReader.END_TAG) {
View Full Code Here

    public void addItemFields(Map<String,Object> fields) {
        Element item = element.addElement("item");
        // Add a field element to the item element for each row in fields
        for (String var : fields.keySet()) {
            Element field = item.addElement("field");
            field.addAttribute("var", var);
            Object value = fields.get(var);
            if (value instanceof Collection) {
                // Add a value element for each entry in the collection
                for (Iterator it = ((Collection) value).iterator(); it.hasNext();) {
                    field.addElement("value").setText(encode(it.next()));
View Full Code Here

     * @param label a label that represents the option.
     * @param value the value of the option.
     */
    public void addOption(String label, String value) {
        Element option = element.addElement("option");
        option.addAttribute("label", label);
        option.addElement("value").setText(value);
    }

    /**
     * Returns the available options to answer for this question. The returned options cannot
View Full Code Here

        }

        if (textElement == null) {
            textElement = docFactory.createElement("text", ERROR_NAMESPACE);
            if (lang != null) {
                textElement.addAttribute(QName.get("lang", "xml",
                        "http://www.w3.org/XML/1998/namespace"), lang);
            }
            element.add(textElement);
        }
        textElement.setText(text);
View Full Code Here

        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

    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
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.