public static Element addChildElement(Element parent, String elementName, String textContent) { Element element = addChildElement(parent, elementName); element.setText(textContent); return element; }
public static Element addChildElement(Element parent, String elementName, String textContent) { Element element = addChildElement(parent, elementName); element.setText(textContent); return element; }
public static boolean updateFirstChild(Element parentElement, String elementName, String value) { if (parentElement != null) { Element element = firstChild(parentElement, elementName); if (element != null) { String textContent = element.getText(); if (textContent == null || !value.equals(textContent)) { element.setText(value); return true; } } } return false; } }
public static boolean updateFirstChild(Element parentElement, String elementName, String value) { if (parentElement != null) { Element element = firstChild(parentElement, elementName); if (element != null) { String textContent = element.getText(); if (textContent == null || !value.equals(textContent)) { element.setText(value); return true; } } } return false; } }
public void setCopyright(String description) { Element copyrightElement = dom.getChild("copyright"); if (copyrightElement == null) { copyrightElement = new Element("copyright"); dom.addNode(copyrightElement); } copyrightElement.setText(description); }
/** * Deploys provided pom.xml file under specified groupId, artifactId and version. The contents of the pom is updated * to match specified groupId, artifactId and version. */ public long deployPom(String groupId, String artifactId, String version, File pomTemplate) throws IOException { final Document pom = XMLParser.parse(pomTemplate); pom.getRootElement().getChild("groupId").setText(groupId); pom.getRootElement().getChild("artifactId").setText(artifactId); pom.getRootElement().getChild("version").setText(version); // pom.getRootElement().getChild( "packaging" ).setText( "pom" ); StringWriter buf = new StringWriter(); XMLWriter writer = new XMLWriter(buf); pom.toXML(writer); String body = buf.toString(); HttpEntity pomEntity = new StringEntity(body, ContentType.TEXT_XML); deploy(pomEntity, groupId, artifactId, version, ".pom"); return body.getBytes(Charsets.UTF_8).length; }
public void setLicense(String license) { Element licenseElement = dom.getChild("license"); if (licenseElement == null) { licenseElement = new Element("license"); dom.addNode(licenseElement); } licenseElement.setText(license); }
public void setDescription(String description) { Element descElement = dom.getChild("description"); if (descElement == null) { descElement = new Element("description"); dom.addNode(descElement); } descElement.setText(description); }
public void setCopyright(String description) { Element copyrightElement = dom.getChild("copyright"); if (copyrightElement == null) { copyrightElement = new Element("copyright"); dom.addNode(copyrightElement); } copyrightElement.setText(description); }
public void setDescription(String description) { Element descElement = dom.getChild("description"); if (descElement == null) { descElement = new Element("description"); dom.addNode(descElement); } descElement.setText(description); }
public void setLicense(String license) { Element licenseElement = dom.getChild("license"); if (licenseElement == null) { licenseElement = new Element("license"); dom.addNode(licenseElement); } licenseElement.setText(license); }