List of usage examples for org.jdom2 Element setAttribute
public Element setAttribute(final String name, final String value)
This sets an attribute value for this element.
From source file:com.tactfactory.harmony.platform.winphone.updater.XmlProjectWinphone.java
License:Open Source License
public void addApplicationDefinitionFile(String filename) { final Element newNode = new Element(XML_ELEMENT_APPLICATION); newNode.setAttribute(XML_ATTRIBUT_INCLUDE, filename); Element subtype = new Element(XML_ELEMENT_SUBTYPE); subtype.setText(XML_CONTENT_DESIGNER); Element generator = new Element(XML_ELEMENT_GENERATOR); generator.setText(XML_CONTENT_MSBUILD_COMPILE); newNode.addContent(subtype);//from ww w. j a va 2s . c o m newNode.addContent(generator); Element itemGroup = this.findFirstItemGroup(XML_ELEMENT_APPLICATION); this.removeIfExists(itemGroup, XML_ELEMENT_APPLICATION, filename); itemGroup.addContent(newNode); }
From source file:com.tactfactory.harmony.platform.winphone.updater.XmlProjectWinphone.java
License:Open Source License
public void addPageFile(String filename) { final Element newNode = new Element(XML_ELEMENT_PAGE); newNode.setAttribute(XML_ATTRIBUT_INCLUDE, filename); Element subtype = new Element(XML_ELEMENT_SUBTYPE); subtype.setText(XML_CONTENT_DESIGNER); Element generator = new Element(XML_ELEMENT_GENERATOR); generator.setText(XML_CONTENT_MSBUILD_COMPILE); newNode.addContent(subtype);/*from w ww . j a va2s . co m*/ newNode.addContent(generator); Element itemGroup = this.findFirstItemGroup(XML_ELEMENT_PAGE); this.removeIfExists(itemGroup, XML_ELEMENT_PAGE, filename); itemGroup.addContent(newNode); }
From source file:com.tactfactory.harmony.platform.winphone.updater.XmlProjectWinphone.java
License:Open Source License
public void addNoneFile(String filename) { final Element newNode = new Element(XML_ELEMENT_NONE); newNode.setAttribute(XML_ATTRIBUT_INCLUDE, filename); Element itemGroup = this.findFirstItemGroup(XML_ELEMENT_NONE); this.removeIfExists(itemGroup, XML_ELEMENT_NONE, filename); itemGroup.addContent(newNode);//from w w w . j a va 2 s . c om }
From source file:com.tactfactory.harmony.platform.winphone.updater.XmlProjectWinphone.java
License:Open Source License
public void addContentFile(String filename) { final Element newNode = new Element(XML_ELEMENT_CONTENT); newNode.setAttribute(XML_ATTRIBUT_INCLUDE, filename); Element itemGroup = this.findFirstItemGroup(XML_ELEMENT_CONTENT); this.removeIfExists(itemGroup, XML_ELEMENT_CONTENT, filename); itemGroup.addContent(newNode);/* www . ja v a 2 s. c o m*/ }
From source file:com.tactfactory.harmony.platform.winphone.updater.XmlProjectWinphone.java
License:Open Source License
public void addEmbeddedFile(String filename) { final Element newNode = new Element(XML_ELEMENT_EMBEDDED); newNode.setAttribute(XML_ATTRIBUT_INCLUDE, filename); Element itemGroup = this.findFirstItemGroup(XML_ELEMENT_EMBEDDED); this.removeIfExists(itemGroup, XML_ELEMENT_EMBEDDED, filename); itemGroup.addContent(newNode);/*from ww w . ja v a2s. c om*/ }
From source file:com.thoughtworks.go.config.MagicalGoConfigXmlWriter.java
License:Apache License
private static Element elementFor(Class<?> aClass, ConfigCache configCache) { final AttributeAwareConfigTag attributeAwareConfigTag = annotationFor(aClass, AttributeAwareConfigTag.class); if (attributeAwareConfigTag != null) { final Element element = new Element(attributeAwareConfigTag.value(), namespaceFor(attributeAwareConfigTag)); element.setAttribute(attributeAwareConfigTag.attribute(), attributeAwareConfigTag.attributeValue()); return element; }// w w w . j av a 2s . c o m ConfigTag configTag = annotationFor(aClass, ConfigTag.class); if (configTag == null) throw bomb(format("Cannot get config tag for {0}", aClass)); return new Element(configTag.value(), namespaceFor(configTag)); }
From source file:com.thoughtworks.go.domain.activity.ProjectStatus.java
License:Apache License
public Element ccTrayXmlElement(String fullContextPath) { Element element = new Element("Project"); element.setAttribute("name", name); element.setAttribute("activity", activity); element.setAttribute("lastBuildStatus", lastBuildStatus); element.setAttribute("lastBuildLabel", lastBuildLabel); element.setAttribute("lastBuildTime", DateUtils.formatIso8601ForCCTray(lastBuildTime)); element.setAttribute("webUrl", fullContextPath + "/" + webUrl); if (!breakers.isEmpty()) { addBreakers(element);//from www .j a va 2s.c om } return element; }
From source file:com.thoughtworks.go.domain.activity.ProjectStatus.java
License:Apache License
private void addBreakers(Element element) { Element messages = new Element("messages"); Element message = new Element("message"); String breakerNames = StringUtils.join(breakers, ", "); message.setAttribute("text", breakerNames); message.setAttribute("kind", "Breakers"); messages.addContent(message);//from w w w.j a v a 2s .c o m element.addContent(messages); }
From source file:Contabilidad.javaToXML.java
/** * Genera el Nodo de Procesamiento del XML y lo agrega a el nodo root * @param directorios Informacin de Directorios contenida en la clase TFactDocMX *///from ww w . j a v a2 s. c o m public void generarProcesamiento(mysuite.TDictionaries directorios) { Element procesamiento = new Element("Procesamiento", PREFIX, PREFIX_URI); for (int a = 0; a < directorios.getDictionary().size(); a++) { Element dis = new Element("Dictionary", PREFIX, PREFIX_URI); dis.setAttribute("name", directorios.getDictionary().get(a).getName()); for (int x = 0; x < directorios.getDictionary().size(); x++) { Element entrada = new Element("Entry", PREFIX, PREFIX_URI); entrada.setAttribute("k", directorios.getDictionary().get(x).getEntry().get(0).getK()); entrada.setAttribute("v", directorios.getDictionary().get(x).getEntry().get(1).getK()); dis.addContent(entrada); } procesamiento.addContent(dis); } root.addContent(procesamiento); }
From source file:controller.MobilePartnerController.java
public void createXML() throws Exception { Element root = new Element("dbconf"); Document doc = new Document(); Element child1 = new Element("url"); child1.addContent("jdbc:mysql://localhost:3306/mobile_partner"); child1.setAttribute("name", "javax.persistence.jdbc.url"); Element child2 = new Element("user"); child2.addContent("root"); child2.setAttribute("name", "javax.persistence.jdbc.user"); Element child3 = new Element("driver"); child3.addContent("com.mysql.jdbc.Driver"); child3.setAttribute("name", "javax.persistence.jdbc.driver"); Element child4 = new Element("password"); child4.addContent("nbuser"); child4.setAttribute("name", "javax.persistence.jdbc.password"); root.addContent(child1);/*from w w w . j av a 2 s.c o m*/ root.addContent(child2); root.addContent(child3); root.addContent(child4); doc.setRootElement(root); XMLOutputter outter = new XMLOutputter(); outter.setFormat(Format.getPrettyFormat()); outter.output(doc, new FileWriter(new File(DIR + "\\dbconf.xml"))); }