private static String getTypeCode(final Element dependencyElement) { if (dependencyElement.hasAttribute("type")) { return dependencyElement.getAttribute("type"); } // Read it from the "type" child element, if any return DomUtils.getTextContent(XmlUtils.findFirstElement("type", dependencyElement), "").trim(); }
/** * Returns the text content of the first child of the given parent that has * the given tag name, if any. * * @param parent the parent in which to search (required) * @param child the child name for which to search (required) * @return <code>null</code> if there is no such child, otherwise the first * such child's text content */ public static String getChildTextContent(final Element parent, final String child) { final List<Element> children = XmlUtils.findElements(child, parent); if (children.isEmpty()) { return null; } return getTextContent(children.get(0), null); }
final String groupId = DomUtils.getTextContent(groupIdElement, ""); final String artifactId = DomUtils.getTextContent(artifactIdElement, ""); final String version = DomUtils.getTextContent(versionElement, ""); final String exclusionGroupId = DomUtils.getTextContent(exclusionGroupIdElement, ""); final String exclusionArtifactId = DomUtils.getTextContent(exclusionArtifactIdElement, "");
/** * Parses the given XML plugin element for the plugin's executions * * @param plugin the XML element to parse (required) * @return a non-<code>null</code> list */ private static List<Execution> getExecutions(final Element plugin) { final List<Execution> executions = new ArrayList<Execution>(); // Loop through the "execution" elements in the plugin element for (final Element execution : XmlUtils.findElements("executions/execution", plugin)) { final Element idElement = XmlUtils.findFirstElement("id", execution); final String id = DomUtils.getTextContent(idElement, ""); final Element phaseElement = XmlUtils.findFirstElement("phase", execution); final String phase = DomUtils.getTextContent(phaseElement, ""); final List<String> goals = new ArrayList<String>(); for (final Element goalElement : XmlUtils.findElements("goals/goal", execution)) { goals.add(goalElement.getTextContent()); } final Configuration configuration = Configuration.getInstance(XmlUtils.findFirstElement("configuration", execution)); executions.add(new Execution(id, phase, configuration, goals.toArray(new String[goals.size()]))); } return executions; }
for (Entry<String, String> element : elementValues.entrySet()) { if (elementValues.size() == 1 && element.getKey().equals(DEFAULT_VALUE_TEXT)) { final String elem = DomUtils.getTextContent(existingElement, ""); if (elem.equals(element.getValue())) { return; DomUtils.getChildElementByTagName(existingElement, element.getKey()); if (childElement != null && DomUtils.getTextContent(childElement, "").equals(element.getValue())) { return;