List of usage examples for org.dom4j Element getStringValue
String getStringValue();
From source file:org.vosao.business.impl.imex.ThemeExporterImpl.java
License:Open Source License
private TemplateEntity readThemeImportXML(final String xml) throws DocumentException { Document doc = DocumentHelper.parseText(xml); Element root = doc.getRootElement(); TemplateEntity template = new TemplateEntity(); for (Iterator<Element> i = root.elementIterator(); i.hasNext();) { Element element = i.next(); if (element.getName().equals("title")) { template.setTitle(element.getStringValue()); }// w ww. ja v a 2 s . c o m if (element.getName().equals("url")) { template.setUrl(element.getStringValue()); } } return template; }
From source file:org.xmlactions.mapping.validation.CompareElements.java
License:Apache License
protected boolean compareElements(String path, Element element1, Element element2) { boolean result = true; if (element1.getName().equals(element2.getName())) { if (isCompareElementContent()) { if (compareElementText(element1, element2) == false) { addError("Element content [" + path + "/\"" + element1.getText() + "\"] does not match [" + element2.getName() + "/\"" + element2.getStringValue() + "\"]"); result = false;//from ww w. ja va2 s . c om } } if (result == true) { result = compareAttributes(element1, element2); } } else { addError("Element Name [" + element1.getName() + "] does not match [" + element2.getName() + "]"); result = false; } return result; }
From source file:pt.webdetails.cdf.dd.FsPluginResourceLocations.java
License:Mozilla Public License
private void initLocations() { for (PathOrigin origin : CdeSettings.getCustomComponentLocations()) { customComponentDirectories.add(origin); }/* www .j a va 2 s . co m*/ // External component locations PluginsAnalyzer pluginsAnalyzer = new PluginsAnalyzer(CdeEnvironment.getContentAccessFactory(), PentahoSystem.get(IPluginManager.class)); pluginsAnalyzer.refresh(); // FIXME will fail often if not everytime for (PluginPair<List<Element>> entry : pluginsAnalyzer.getPluginsWithSection("/cde-components/path")) { for (Element pathNode : entry.getValue()) { String path = StringUtils.strip(pathNode.getStringValue()); String origin = pathNode.attributeValue("origin");//TODO:hcoded if (StringUtils.isEmpty(origin)) { //FIXME: customComponentDirectories.add(inferPathOriginFromLegacyLocation(entry.getPlugin(), path)); logger.debug(String.format("Found CDE components location declared in %s [%s]", entry.getPlugin().getId(), path)); } } } }
From source file:pt.webdetails.cdf.dd.model.meta.reader.cdexml.XmlComponentTypeReader.java
License:Open Source License
private String readBaseProperties(ComponentType.Builder builder, Element elem, String sourcePath) { // componentElem is <DesignerComponent> String componentName = elem.selectSingleNode("Header/IName") != null ? elem.selectSingleNode("Header/IName").getText() : null;//from w w w .j av a2s .c o m builder.setName(componentName).setLabel(Utils.getNodeText("Header/Name", elem)) .setTooltip(Utils.getNodeText("Header/Description", elem)) .setCategory(Utils.getNodeText("Header/Category", elem)) .setCategoryLabel(Utils.getNodeText("Header/CatDescription", elem)).setSourcePath(sourcePath) .setVersion(Utils.getNodeText("Header/Version", elem)); String visibleText = Utils.getNodeText("Header/Visible", elem); if (StringUtils.isNotEmpty(visibleText)) { builder.setVisible("true".equalsIgnoreCase(visibleText)); } @SuppressWarnings("unchecked") List<Element> legacyNamesElems = elem.selectNodes("Header/LegacyIName"); for (Element legacyNameElem : legacyNamesElems) { String legacyName = legacyNameElem.getStringValue(); if (StringUtils.isNotBlank(legacyName)) { builder.addLegacyName(legacyName); } } return componentName; }
From source file:uk.ac.ed.portlets.almaportlet.service.AlmaReaderService.java
License:Apache License
/** * Parse xml as a list of hash table which wraps library object * @param xml xml as string from the web service * @return a list of hash table which wraps library object *//*from w w w .j av a 2s .c om*/ public ArrayList<Hashtable<String, String>> parseXML(String xml) throws Exception { ArrayList<Hashtable<String, String>> list = new ArrayList<Hashtable<String, String>>(); Document document = DocumentHelper.parseText(xml); Element root = document.getRootElement(); for (Iterator i = root.elementIterator(); i.hasNext();) { Element parent = (Element) i.next(); Hashtable<String, String> table = new Hashtable<String, String>(); for (Iterator r = parent.elementIterator(); r.hasNext();) { Element child = (Element) r.next(); table.put(child.getName(), child.getStringValue()); } list.add(table); } logger.debug("parseXML --> " + list); return list; }