Example usage for org.dom4j Element getText

List of usage examples for org.dom4j Element getText

Introduction

In this page you can find the example usage for org.dom4j Element getText.

Prototype

String getText();

Source Link

Document

Returns the text value of this element without recursing through child elements.

Usage

From source file:com.jaspersoft.jasperserver.export.modules.mt.TenantImporter.java

License:Open Source License

public List<String> process() {
    for (Iterator it = indexElement.elementIterator(moduleConfiguration.getTenantIndexElement()); it
            .hasNext();) {//w  ww . j a  v  a  2 s.c o  m
        Element tenantElement = (Element) it.next();
        String tenantId = tenantElement.getText();
        process(tenantId);
    }
    return null;
}

From source file:com.jaspersoft.jasperserver.export.modules.repository.ResourceImporter.java

License:Open Source License

protected void queueEntryFolders() {
    List entryFolders = new ArrayList();
    for (Iterator it = indexElement.elementIterator(configuration.getFolderIndexElement()); it.hasNext();) {
        Element folderElement = (Element) it.next();
        entryFolders.add(folderElement.getText());
    }/*from ww  w.j a  va  2 s.  c o  m*/

    if (!entryFolders.isEmpty()) {
        Collections.sort(entryFolders);
        for (Iterator it = entryFolders.iterator(); it.hasNext();) {
            String uri = (String) it.next();
            folderQueue.addLast(uri);
        }
    }
}

From source file:com.jaspersoft.jasperserver.export.modules.repository.ResourceImporter.java

License:Open Source License

protected void queueEntryResources() {
    for (Iterator it = indexElement.elementIterator(configuration.getResourceIndexElement()); it.hasNext();) {
        Element resourceElement = (Element) it.next();
        String uri = resourceElement.getText();
        resourceQueue.addLast(uri);//from  w  w w  .jav a 2  s  . c o  m
    }
}

From source file:com.jaspersoft.jasperserver.export.modules.scheduling.CalendarsImporter.java

License:Open Source License

public List<String> process() {

    for (Iterator i = indexElement.elementIterator(configuration.getIndexCalendarElement()); i.hasNext();) {
        Element calendarElement = (Element) i.next();
        String name = calendarElement.getText();
        processCalendar(name);//from  w ww .j a  va 2 s  .  c  o m
    }
    return null;
}

From source file:com.jaspersoft.jasperserver.export.modules.scheduling.ReportJobsImporter.java

License:Open Source License

public List<String> process() {
    initProcess();//ww w . j ava2  s. c  o  m

    for (Iterator i = indexElement.elementIterator(configuration.getIndexReportUnitElement()); i.hasNext();) {
        Element ruElement = (Element) i.next();
        String uri = ruElement.getText();
        processReportUnit(uri);
    }
    return null;
}

From source file:com.jeeframework.util.xml.XMLProperties.java

License:Open Source License

/**
 * Return all values who's path matches the given property
 * name as a String array, or an empty array if the if there
 * are no children. This allows you to retrieve several values
 * with the same property name. For example, consider the
 * XML file entry://from w w w .  j  a va2 s.co m
 * <pre>
 * &lt;foo&gt;
 *     &lt;bar&gt;
 *         &lt;prop&gt;some value&lt;/prop&gt;
 *         &lt;prop&gt;other value&lt;/prop&gt;
 *         &lt;prop&gt;last value&lt;/prop&gt;
 *     &lt;/bar&gt;
 * &lt;/foo&gt;
 * </pre>
 * If you call getProperties("foo.bar.prop") will return a string array containing
 * {"some value", "other value", "last value"}.
 *
 * @param name the name of the property to retrieve
 * @return all child property values for the given node name.
 */
public Iterator getChildProperties(String name) {
    String[] propName = parsePropertyName(name);
    // Search for this property by traversing down the XML hierarchy,
    // stopping one short.
    Element element = document.getRootElement();
    for (int i = 0; i < propName.length - 1; i++) {
        element = element.element(propName[i]);
        if (element == null) {
            // This node doesn't match this part of the property name which
            // indicates this property doesn't exist so return empty array.
            return Collections.EMPTY_LIST.iterator();
        }
    }
    // We found matching property, return values of the children.
    Iterator<Element> iter = element.elementIterator(propName[propName.length - 1]);
    ArrayList<String> props = new ArrayList<String>();
    Element prop;
    String value;
    while (iter.hasNext()) {
        prop = iter.next();
        value = prop.getText();
        // check to see if the property is marked as encrypted
        if (Boolean.parseBoolean(prop.attribute(ENCRYPTED_ATTRIBUTE).getText())) {
            value = EncryptUtil.desDecrypt(encryptKey, value);
        }
        props.add(value);
    }
    return props.iterator();
}

From source file:com.jinglingtec.ijiazu.util.CCPRestSmsSDK.java

License:Open Source License

/**
 * @param xml//w w w .j a  va 2 s .  c o m
 *
 * @return Map
 *
 * @description xml??map
 */
private HashMap<String, Object> xmlToMap(String xml) {
    HashMap<String, Object> map = new HashMap<String, Object>();
    Document doc = null;
    try {
        doc = DocumentHelper.parseText(xml); // XML
        Element rootElt = doc.getRootElement(); // ?
        HashMap<String, Object> hashMap2 = new HashMap<String, Object>();
        for (Iterator i = rootElt.elementIterator(); i.hasNext();) {
            Element e = (Element) i.next();
            if ("statusCode".equals(e.getName()) || "statusMsg".equals(e.getName())) {
                map.put(e.getName(), e.getText());
            } else {
                if ("SubAccount".equals(e.getName()) || "totalCount".equals(e.getName())
                        || "token".equals(e.getName()) || "downUrl".equals(e.getName())) {
                    if (!"SubAccount".equals(e.getName())) {
                        hashMap2.put(e.getName(), e.getText());
                    } else {
                        ArrayList<HashMap<String, Object>> arrayList = new ArrayList<HashMap<String, Object>>();
                        HashMap<String, Object> hashMap3 = new HashMap<String, Object>();
                        for (Iterator i2 = e.elementIterator(); i2.hasNext();) {
                            Element e2 = (Element) i2.next();
                            hashMap3.put(e2.getName(), e2.getText());
                            arrayList.add(hashMap3);
                        }
                        hashMap2.put("SubAccount", arrayList);
                    }
                    map.put("data", hashMap2);
                } else {

                    HashMap<String, Object> hashMap3 = new HashMap<String, Object>();
                    for (Iterator i2 = e.elementIterator(); i2.hasNext();) {
                        Element e2 = (Element) i2.next();
                        // hashMap2.put(e2.getName(),e2.getText());
                        hashMap3.put(e2.getName(), e2.getText());
                    }
                    if (hashMap3.size() != 0) {
                        hashMap2.put(e.getName(), hashMap3);
                    } else {
                        hashMap2.put(e.getName(), e.getText());
                    }
                    map.put("data", hashMap2);
                }
            }
        }
    } catch (DocumentException e) {
        e.printStackTrace();
        LoggerUtil.error(e.getMessage());
    } catch (Exception e) {
        LoggerUtil.error(e.getMessage());
        e.printStackTrace();
    }
    return map;
}

From source file:com.joseprado.levaetraztransporte.factory.RotaFactory.java

/**
 * Metodo responsvel por retornar o valor em distancia entre as cidades.
 * @param document//from  w ww  .  j a  v  a2  s  .  c om
 * @return 
 */
@SuppressWarnings("rawtypes")
public static String retornaKM(Document document) {
    String textoXml = document.getText();

    List list = document.selectNodes("//DirectionsResponse/route/leg/distance/text");

    Element element = (Element) list.get(list.size() - 1);

    return element.getText();
}

From source file:com.joseprado.levaetraztransporte.factory.RotaFactory.java

/**
 * Mtodo responsvel por trazer a rota que deve ser seguida no caminho.
 * @param document/*  w  ww . j  ava 2 s  .  c o m*/
 * @return 
 */
private String retornaRota(Document document) {
    List listCaminho = document.selectNodes("//DirectionsResponse/route/leg/step/html_instructions");
    String rota = "";

    for (Object listCaminho1 : listCaminho) {
        Element element = (Element) listCaminho1;

        rota += element.getText().concat("\n");
    }

    return rota;
}

From source file:com.jswiff.xml.ActionXMLReader.java

License:Open Source License

private static UnknownAction readUnknownAction(Element element) {
    return new UnknownAction(RecordXMLReader.getShortAttribute("code", element),
            Base64.decode(element.getText()));
}