Example usage for org.dom4j Element elementIterator

List of usage examples for org.dom4j Element elementIterator

Introduction

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

Prototype

Iterator<Element> elementIterator(QName qName);

Source Link

Document

Returns an iterator over the elements contained in this element which match the given fully qualified name.

Usage

From source file:com.doculibre.constellio.opensearch.OpenSearchSolrServer.java

License:Open Source License

@SuppressWarnings("unchecked")
private static SolrDocumentList parse(Element rootElement) throws IOException {
    SolrDocumentList solrDocumentList = new SolrDocumentList();
    Element channelElement = rootElement.element("channel");
    String totalResultsStr = channelElement.elementText(new QName("totalResults", NS_OPENSEARCH));
    String startIndexStr = channelElement.elementText(new QName("startIndex", NS_OPENSEARCH));
    long numFound = Long.parseLong(totalResultsStr);
    long start = Long.parseLong(startIndexStr);
    solrDocumentList.setNumFound(numFound);
    solrDocumentList.setStart(start);/* w  w  w  .  ja v  a  2 s  .c  om*/

    for (Iterator<Element> it = channelElement.elementIterator("item"); it.hasNext();) {
        Element itemElement = it.next();
        String title = itemElement.elementText("title");
        String description = itemElement.elementText("description");
        String link = itemElement.elementText("link");

        title = CharSetUtils.convert(title, CharSetUtils.UTF_8, CharSetUtils.ISO_8859_1);
        description = CharSetUtils.convert(description, CharSetUtils.UTF_8, CharSetUtils.ISO_8859_1);
        link = CharSetUtils.convert(link, CharSetUtils.UTF_8, CharSetUtils.ISO_8859_1);

        SolrDocument solrDocument = new SolrDocument();
        solrDocument.addField("title", title);
        solrDocument.addField("description", description);
        solrDocument.addField("link", link);
        solrDocumentList.add(solrDocument);
    }
    return solrDocumentList;
}

From source file:com.doculibre.constellio.services.SolrServicesImpl.java

License:Open Source License

@SuppressWarnings("unchecked")
public static void removeAll(Element element, String code) {
    for (Iterator<Element> it = element.elementIterator(code); it.hasNext();) {
        it.next();//from w ww . j  ava  2 s. co  m
        it.remove();
    }
}

From source file:com.doculibre.constellio.services.SolrServicesImpl.java

License:Open Source License

@SuppressWarnings("unchecked")
@Override/*from ww w .j  a v a2s .c  o m*/
public void resetDefaultDistance(RecordCollection collection) {
    ensureCore(collection);

    Document solrConfigDocument = readSolrConfig(collection);
    Element root = solrConfigDocument.getRootElement();

    // 1. remove all requestHandler with name DISMAX_ATTRIBUTE_NAME
    for (Iterator<Element> it = root.elementIterator("requestHandler"); it.hasNext();) {
        Element currentRequestHandlerElement = it.next();
        String currentSearchComponentName = currentRequestHandlerElement.attribute("name").getText();
        if (currentSearchComponentName.equals(DISMAX_ATTRIBUTE_NAME)) {
            it.remove();
        }
    }
    // 2. set requestHandler with name DEFAULT_DISTANCE_NAME as the
    // default distance
    for (Iterator<Element> it = root.elementIterator("requestHandler"); it.hasNext();) {
        Element currentRequestHandlerElement = it.next();
        String currentSearchComponentName = currentRequestHandlerElement.attribute("name").getText();
        if (currentSearchComponentName.equals(DEFAULT_DISTANCE_NAME)) {
            Attribute defaultAttribute = currentRequestHandlerElement.attribute("default");
            if (defaultAttribute != null) {
                defaultAttribute.setText("true");
            } else {
                currentRequestHandlerElement.addAttribute("default", "true");
            }
            break;
        }
    }

    writeSolrConfig(collection, solrConfigDocument);
    initCore(collection);
}

From source file:com.doculibre.constellio.services.SolrServicesImpl.java

License:Open Source License

@SuppressWarnings("unchecked")
@Override//from  w w  w .  j av a 2 s  .  c  o m
public void updateDismax(RecordCollection collection) {
    ensureCore(collection);

    Element dismaxElement = getDismaxElement(collection);
    Document solrConfigDocument = readSolrConfig(collection);
    Element root = solrConfigDocument.getRootElement();

    boolean defaultSearchFieldFound = false;
    // 1. keep only one requestHandler with name DISMAX_ATTRIBUTE_NAME
    for (Iterator<Element> it = root.elementIterator("requestHandler"); it.hasNext();) {
        Element currentRequestHandlerElement = it.next();
        String currentSearchComponentName = currentRequestHandlerElement.attribute("name").getText();
        if (currentSearchComponentName.equals(DISMAX_ATTRIBUTE_NAME)) {
            // first copy other fields that are not defaults if the
            // query was set as default
            if (!defaultSearchFieldFound) {
                Attribute defaultAttribute = currentRequestHandlerElement.attribute("default");
                if (defaultAttribute != null && defaultAttribute.getText().equals("true")) {
                    defaultSearchFieldFound = true;
                    defaultAttribute.setText("false");
                    List<Element> elements = currentRequestHandlerElement.elements();
                    for (Element element : elements) {
                        if (element.attribute("name") != null
                                && !element.attribute("name").getValue().equals("defaults")) {
                            BaseElement cloneElement = new BaseElement(element.getName());
                            cloneElement.appendAttributes(element);
                            cloneElement.appendContent(element);
                            dismaxElement.add(cloneElement);
                        }
                    }
                }
            }
            it.remove();
        }
    }
    if (!defaultSearchFieldFound) {
        // 2. add the parameters of the default RequestHandler to dismax
        // requestHandler (escape the parameter with name="defaults")
        for (Iterator<Element> it = root.elementIterator("requestHandler"); it.hasNext();) {
            Element currentRequestHandlerElement = it.next();
            Attribute defaultAttribute = currentRequestHandlerElement.attribute("default");
            if (defaultAttribute != null && defaultAttribute.getText().equals("true")) {
                defaultAttribute.setText("false");
                List<Element> elements = currentRequestHandlerElement.elements();
                for (Element element : elements) {
                    if (element.attribute("name") != null
                            && !element.attribute("name").getValue().equals("defaults")) {
                        BaseElement cloneElement = new BaseElement(element.getName());
                        cloneElement.appendAttributes(element);
                        cloneElement.appendContent(element);
                        dismaxElement.add(cloneElement);
                    }
                }
                break;
            }
        }
    }

    root.add(dismaxElement);

    writeSolrConfig(collection, solrConfigDocument);
    initCore(collection);
}

From source file:com.doculibre.constellio.services.SolrServicesImpl.java

License:Open Source License

@SuppressWarnings("unchecked")
@Override/*from   w  w  w .j  a va  2 s.  c o m*/
public boolean usesDisMax(RecordCollection collection) {
    ensureCore(collection);

    Document solrconfigXmlDocument = readSolrConfig(collection);
    Element root = solrconfigXmlDocument.getRootElement();

    for (Iterator<Element> it = root.elementIterator("requestHandler"); it.hasNext();) {
        Element currentRequestHandlerElement = it.next();
        String currentSearchComponentName = currentRequestHandlerElement.attribute("name").getText();
        if (currentSearchComponentName.equals(DISMAX_ATTRIBUTE_NAME)) {
            return true;
        }
    }
    return false;
}

From source file:com.doculibre.constellio.utils.izpack.UsersXmlFileUtils.java

License:Open Source License

@SuppressWarnings("unchecked")
public static List<ConstellioUser> readUsers(String fileName) {
    List<ConstellioUser> returnList = new ArrayList<ConstellioUser>();

    File xmlFile = new File(fileName);

    Document xmlDocument;//from   w  w w.  j a  v a  2  s  . c  o m
    if (!xmlFile.exists()) {
        return returnList;
    }
    try {
        xmlDocument = new SAXReader().read(xmlFile);
    } catch (DocumentException e) {
        e.printStackTrace();
        return returnList;
    }

    Element root = xmlDocument.getRootElement();
    for (Iterator<Element> it = root.elementIterator(USER); it.hasNext();) {
        Element currentUser = it.next();
        returnList.add(toConstellioUser(currentUser));

    }
    return returnList;
}

From source file:com.doculibre.constellio.utils.izpack.UsersXmlFileUtils.java

License:Open Source License

@SuppressWarnings("unchecked")
private static ConstellioUser toConstellioUser(Element element) {
    ConstellioUser constellioUser = new ConstellioUser();

    constellioUser.setFirstName(element.attributeValue(FIRST_NAME));
    constellioUser.setLastName(element.attributeValue(LAST_NAME));
    constellioUser.setUsername(element.attributeValue(LOGIN));
    constellioUser.setPasswordHash(element.attributeValue(PASSWORD_HASH));

    Attribute locale = element.attribute(LOCALE);

    if (locale != null) {
        constellioUser.setLocaleCode(locale.getValue());
    } else {/*from   w  w  w .j  a  v a2  s. co m*/
        constellioUser.setLocale(ConstellioSpringUtils.getDefaultLocale());
    }

    Iterator<Element> rolesIt = element.elementIterator(ROLES);
    if (rolesIt != null) {
        Element roles = rolesIt.next();
        for (Iterator<Element> it = roles.elementIterator(ROLE); it.hasNext();) {
            Element currentRole = it.next();
            constellioUser.addRole(currentRole.attributeValue(VALUE));
        }
    }

    return constellioUser;
}

From source file:com.doculibre.constellio.wicket.panels.results.DefaultSearchResultPanel.java

License:Open Source License

public DefaultSearchResultPanel(String id, SolrDocument doc, final SearchResultsDataProvider dataProvider) {
    super(id);//  w  w w  .  j av a2s  .c om

    RecordCollectionServices collectionServices = ConstellioSpringUtils.getRecordCollectionServices();
    RecordServices recordServices = ConstellioSpringUtils.getRecordServices();
    SearchInterfaceConfigServices searchInterfaceConfigServices = ConstellioSpringUtils
            .getSearchInterfaceConfigServices();

    String collectionName = dataProvider.getSimpleSearch().getCollectionName();

    RecordCollection collection = collectionServices.get(collectionName);
    Record record = recordServices.get(doc);
    if (record != null) {
        SearchInterfaceConfig searchInterfaceConfig = searchInterfaceConfigServices.get();

        IndexField uniqueKeyField = collection.getUniqueKeyIndexField();
        IndexField defaultSearchField = collection.getDefaultSearchIndexField();
        IndexField urlField = collection.getUrlIndexField();
        IndexField titleField = collection.getTitleIndexField();

        if (urlField == null) {
            urlField = uniqueKeyField;
        }
        if (titleField == null) {
            titleField = urlField;
        }

        final String recordURL = record.getUrl();
        final String displayURL;

        if (record.getDisplayUrl().startsWith("/get?file=")) {
            HttpServletRequest req = ((WebRequest) getRequest()).getHttpServletRequest();
            displayURL = ContextUrlUtils.getContextUrl(req) + record.getDisplayUrl();

        } else {
            displayURL = record.getDisplayUrl();
        }

        String title = record.getDisplayTitle();

        final String protocol = StringUtils.substringBefore(displayURL, ":");
        boolean linkEnabled = isLinkEnabled(protocol);

        // rcupration des champs highlight  partir de la cl unique
        // du document, dans le cas de Nutch c'est l'URL
        QueryResponse response = dataProvider.getQueryResponse();
        Map<String, Map<String, List<String>>> highlighting = response.getHighlighting();
        Map<String, List<String>> fieldsHighlighting = highlighting.get(recordURL);

        String titleHighlight = getTitleFromHighlight(titleField.getName(), fieldsHighlighting);
        if (titleHighlight != null) {
            title = titleHighlight;
        }

        String excerpt = null;
        String description = getDescription(record);
        String summary = getSummary(record);

        if (StringUtils.isNotBlank(description) && searchInterfaceConfig.isDescriptionAsExcerpt()) {
            excerpt = description;
        } else {
            excerpt = getExcerptFromHighlight(defaultSearchField.getName(), fieldsHighlighting);
            if (excerpt == null) {
                excerpt = description;
            }
        }

        toggleSummaryLink = new WebMarkupContainer("toggleSummaryLink");
        add(toggleSummaryLink);
        toggleSummaryLink.setVisible(StringUtils.isNotBlank(summary));
        toggleSummaryLink.add(new AttributeModifier("onclick", new LoadableDetachableModel() {
            @Override
            protected Object load() {
                return "toggleSearchResultSummary('" + summaryLabel.getMarkupId() + "')";
            }
        }));

        summaryLabel = new Label("summary", summary);
        add(summaryLabel);
        summaryLabel.setOutputMarkupId(true);
        summaryLabel.setVisible(StringUtils.isNotBlank(summary));

        ExternalLink titleLink;
        if (displayURL.startsWith("file://")) {
            HttpServletRequest req = ((WebRequest) getRequest()).getHttpServletRequest();
            String newDisplayURL = ContextUrlUtils.getContextUrl(req) + "app/getSmbFile?"
                    + SmbServletPage.RECORD_ID + "=" + record.getId() + "&" + SmbServletPage.COLLECTION + "="
                    + collectionName;
            titleLink = new ExternalLink("titleLink", newDisplayURL);
        } else {
            titleLink = new ExternalLink("titleLink", displayURL);
        }

        final RecordModel recordModel = new RecordModel(record);
        AttributeModifier computeClickAttributeModifier = new AttributeModifier("onmousedown", true,
                new LoadableDetachableModel() {
                    @Override
                    protected Object load() {
                        Record record = recordModel.getObject();
                        SimpleSearch simpleSearch = dataProvider.getSimpleSearch();
                        WebRequest webRequest = (WebRequest) RequestCycle.get().getRequest();
                        HttpServletRequest httpRequest = webRequest.getHttpServletRequest();
                        return ComputeSearchResultClickServlet.getCallbackJavascript(httpRequest, simpleSearch,
                                record);
                    }
                });
        titleLink.add(computeClickAttributeModifier);
        titleLink.setEnabled(linkEnabled);

        boolean resultsInNewWindow;
        PageParameters params = RequestCycle.get().getPageParameters();
        if (params != null && params.getString(POPUP_LINK) != null) {
            resultsInNewWindow = params.getBoolean(POPUP_LINK);
        } else {
            resultsInNewWindow = searchInterfaceConfig.isResultsInNewWindow();
        }
        titleLink.add(new SimpleAttributeModifier("target", resultsInNewWindow ? "_blank" : "_self"));

        // Add title
        title = StringUtils.remove(title, "\n");
        title = StringUtils.remove(title, "\r");
        if (StringUtils.isEmpty(title)) {
            title = StringUtils.defaultString(displayURL);
            title = StringUtils.substringAfterLast(title, "/");
            title = StringUtils.substringBefore(title, "?");
            try {
                title = URLDecoder.decode(title, "UTF-8");
            } catch (UnsupportedEncodingException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            if (title.length() > 120) {
                title = title.substring(0, 120) + " ...";
            }
        }

        Label titleLabel = new Label("title", title);
        titleLink.add(titleLabel.setEscapeModelStrings(false));
        add(titleLink);

        Label excerptLabel = new Label("excerpt", excerpt);
        add(excerptLabel.setEscapeModelStrings(false));
        // add(new ExternalLink("url", url,
        // url).add(computeClickAttributeModifier).setEnabled(linkEnabled));
        if (displayURL.startsWith("file://")) {
            // Creates a Windows path for file URLs
            String urlLabel = StringUtils.substringAfter(displayURL, "file:");
            urlLabel = StringUtils.stripStart(urlLabel, "/");
            urlLabel = "\\\\" + StringUtils.replace(urlLabel, "/", "\\");
            try {
                urlLabel = URLDecoder.decode(urlLabel, "UTF-8");
            } catch (UnsupportedEncodingException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            add(new Label("url", urlLabel));
        } else {
            add(new Label("url", displayURL));
        }

        final ReloadableEntityModel<RecordCollection> collectionModel = new ReloadableEntityModel<RecordCollection>(
                collection);
        add(new ListView("searchResultFields", new LoadableDetachableModel() {
            @Override
            protected Object load() {
                RecordCollection collection = collectionModel.getObject();
                return collection.getSearchResultFields();
            }

            /**
             * Detaches from the current request. Implement this method with
             * custom behavior, such as setting the model object to null.
             */
            protected void onDetach() {
                recordModel.detach();
                collectionModel.detach();
            }
        }) {
            @Override
            protected void populateItem(ListItem item) {
                SearchResultField searchResultField = (SearchResultField) item.getModelObject();
                IndexFieldServices indexFieldServices = ConstellioSpringUtils.getIndexFieldServices();
                Record record = recordModel.getObject();
                IndexField indexField = searchResultField.getIndexField();
                Locale locale = getLocale();
                String indexFieldTitle = indexField.getTitle(locale);
                if (StringUtils.isBlank(indexFieldTitle)) {
                    indexFieldTitle = indexField.getName();
                }
                StringBuffer fieldValueSb = new StringBuffer();
                List<Object> fieldValues = indexFieldServices.extractFieldValues(record, indexField);
                Map<String, String> defaultLabelledValues = indexFieldServices
                        .getDefaultLabelledValues(indexField, locale);
                for (Object fieldValue : fieldValues) {
                    if (fieldValueSb.length() > 0) {
                        fieldValueSb.append("\n");
                    }
                    String fieldValueLabel = indexField.getLabelledValue("" + fieldValue, locale);
                    if (fieldValueLabel == null) {
                        fieldValueLabel = defaultLabelledValues.get("" + fieldValue);
                    }
                    if (fieldValueLabel == null) {
                        fieldValueLabel = "" + fieldValue;
                    }
                    fieldValueSb.append(fieldValueLabel);
                }

                item.add(new Label("indexField", indexFieldTitle));
                item.add(new MultiLineLabel("indexFieldValue", fieldValueSb.toString()));
                item.setVisible(fieldValueSb.length() > 0);
            }

            @SuppressWarnings("unchecked")
            @Override
            public boolean isVisible() {
                boolean visible = super.isVisible();
                if (visible) {
                    List<SearchResultField> searchResultFields = (List<SearchResultField>) getModelObject();
                    visible = !searchResultFields.isEmpty();
                }
                return visible;
            }
        });

        // md5
        ConstellioSession session = ConstellioSession.get();
        ConstellioUser user = session.getUser();
        // TODO Provide access to unauthenticated users ?
        String md5 = "";
        if (user != null) {
            IntelliGIDServiceInfo intelligidServiceInfo = ConstellioSpringUtils.getIntelliGIDServiceInfo();
            if (intelligidServiceInfo != null) {
                Collection<Object> md5Coll = doc.getFieldValues(IndexField.MD5);
                if (md5Coll != null) {
                    for (Object md5Obj : md5Coll) {
                        try {
                            String md5Str = new String(Hex.encodeHex(Base64.decodeBase64(md5Obj.toString())));
                            InputStream is = HttpClientHelper
                                    .get(intelligidServiceInfo.getIntelligidUrl() + "/connector/checksum",
                                            "md5=" + URLEncoder.encode(md5Str, "ISO-8859-1"),
                                            "username=" + URLEncoder.encode(user.getUsername(), "ISO-8859-1"),
                                            "password=" + URLEncoder.encode(Base64.encodeBase64String(
                                                    ConstellioSession.get().getPassword().getBytes())),
                                            "ISO-8859-1");
                            try {
                                Document xmlDocument = new SAXReader().read(is);
                                Element root = xmlDocument.getRootElement();
                                for (Iterator<Element> it = root.elementIterator("fichier"); it.hasNext();) {
                                    Element fichier = it.next();
                                    String url = fichier.attributeValue("url");
                                    md5 += "<a href=\"" + url + "\">" + url + "</a> ";
                                }
                            } finally {
                                IOUtils.closeQuietly(is);
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }
            }
        }
        Label md5Label = new Label("md5", md5) {
            public boolean isVisible() {
                boolean visible = super.isVisible();
                if (visible) {
                    visible = StringUtils.isNotBlank(this.getModelObjectAsString());
                }
                return visible;
            }
        };
        md5Label.setEscapeModelStrings(false);
        add(md5Label);

        add(new ElevatePanel("elevatePanel", record, dataProvider.getSimpleSearch()));
    } else {
        setVisible(false);
    }
}

From source file:com.dsh105.nexus.command.module.information.WolframAlphaCommand.java

License:Open Source License

@Override
public boolean onCommand(CommandPerformEvent event) {
    if (event.getArgs().length == 0) {
        return false;
    }//from www.  j  av a 2 s .  co m

    String apiKey = Nexus.getInstance().getConfig().getWolframAlphaKey();
    if (apiKey.isEmpty()) {
        event.errorWithPing("Failed to query WolframAlpha - API key has not been configured.");
        Nexus.LOGGER.warning("User attempted to access WolframAlpha - API key is invalid!");
        return true;
    }

    String input = StringUtil.combineSplit(0, event.getArgs(), " ");

    StringBuilder answer = new StringBuilder();
    try {
        String apiUrl = String.format(API_URL, URLEncoder.encode(input, "UTF-8"), apiKey);
        Nexus.LOGGER.info("Requesting WolframAlpha interpretation at " + apiUrl);

        SAXReader reader = new SAXReader();
        Document document = reader.read(Unirest.get(apiUrl).asBinary().getBody());

        Element root = document.getRootElement();

        if (Boolean.valueOf(root.attribute("success").getValue())) {
            for (Iterator pods = root.elementIterator("pod"); pods.hasNext();) {
                Element pod = (Element) pods.next();
                String primary = pod.attributeValue("primary");
                if (primary != null && Boolean.valueOf(primary)) {
                    for (Iterator subpods = pod.elementIterator("subpod"); subpods.hasNext();) {
                        Element subpod = (Element) subpods.next();
                        String result = subpod.element("plaintext").getText();
                        if (result != null && !result.isEmpty()) {
                            answer.append(result.replaceAll("\\n", " - ").replaceAll("\\s+", " "));
                        }
                    }
                }
            }
            if (answer.length() > 0) {
                event.respondWithPing(
                        answer + " (" + URLShortener.shorten(String.format(QUERY_URL, input)) + ")");
                return true;
            }
        }

        List<String> tips = new ArrayList<>();
        if (root.element("tips") != null) {
            for (Iterator tipElements = root.element("tips").elementIterator("tip"); tipElements.hasNext();) {
                if (tips.size() > 3) {
                    break;
                }
                Element tip = (Element) tipElements.next();
                String result = tip.attributeValue("text");
                if (result != null && !result.isEmpty()) {
                    tips.add(result.replaceAll("\\s+", " "));
                }
            }
        }
        event.errorWithPing("WolframAlpha could not interpret that!");
        if (!tips.isEmpty()) {
            event.errorWithPing(Colors.BOLD + "Tips" + Colors.BOLD + ": "
                    + StringUtil.combineSplit(0, tips.toArray(new String[tips.size()]), "; "));
        }
        return true;
    } catch (UnirestException e) {
        throw new WolframAlphaQueryException("Failed to execute WolframAlpha query: " + input, e);
    } catch (DocumentException e) {
        throw new WolframAlphaQueryException("Failed to execute WolframAlpha query: " + input, e);
    } catch (UnsupportedEncodingException e) {
        throw new WolframAlphaQueryException("Failed to encode URL", e);
    }
}

From source file:com.ewcms.content.particular.util.XmlConvert.java

License:Open Source License

@SuppressWarnings("unchecked")
public static List<Map<String, Object>> importXML(File xmlFile, String fileType) {
    if (xmlFile != null) {
        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
        try {/*w w w  .ja  v a2  s.c  o  m*/
            List<InputStream> inputStreams = new ArrayList<InputStream>();
            //FileType fileType = FileTypeJudge.getType(xmlFile);
            if (fileType.toLowerCase().equals("application/zip")) {
                inputStreams = parseXmlZIPFile(xmlFile);
            } else if (fileType.toLowerCase().equals("text/xml")) {
                InputStream in = new FileInputStream(xmlFile);
                inputStreams.add(in);
            } else {
                return null;
            }
            if (!inputStreams.isEmpty()) {
                SAXReader reader = new SAXReader();
                Document doc = null;
                for (InputStream inputStream : inputStreams) {
                    try {
                        doc = reader.read(inputStream);
                        if (doc != null) {
                            Element root = doc.getRootElement();
                            Element metaViewData;
                            Element projecties;
                            for (Iterator<?> metaViewDataIterator = root
                                    .elementIterator("MetaViewData"); metaViewDataIterator.hasNext();) {
                                metaViewData = (Element) metaViewDataIterator.next();
                                for (Iterator<?> projectiesIterator = metaViewData
                                        .elementIterator("PROPERTIES"); projectiesIterator.hasNext();) {
                                    projecties = (Element) projectiesIterator.next();
                                    List<Element> elements = projecties.elements();
                                    if (!elements.isEmpty()) {
                                        Map<String, Object> map = new HashMap<String, Object>();
                                        for (Element element : elements) {
                                            map.put(element.getName(), element.getData());
                                        }
                                        list.add(map);
                                    }
                                }
                            }
                        }
                    } catch (DocumentException e) {
                    } finally {
                        if (doc != null) {
                            doc.clearContent();
                            doc = null;
                        }
                    }
                }
            }
        } catch (IOException e) {
            return null;
        }
        return list;
    }
    return null;
}