/** * Visits all values of this XML content with the given value visitor.<p> * * Please note that the order in which the values are visited may NOT be the * order they appear in the XML document. It is ensured that the the parent * of a nested value is visited before the element it contains.<p> * * @param visitor the value visitor implementation to visit the values with */ public void visitAllValuesWith(I_CmsXmlContentValueVisitor visitor) { List<String> bookmarks = new ArrayList<String>(getBookmarks()); Collections.sort(bookmarks); for (int i = 0; i < bookmarks.size(); i++) { String key = bookmarks.get(i); I_CmsXmlContentValue value = getBookmark(key); visitor.visit(value); } }
/** * Visits all values of this XML content with the given value visitor.<p> * * Please note that the order in which the values are visited may NOT be the * order they appear in the XML document. It is ensured that the the parent * of a nested value is visited before the element it contains.<p> * * @param visitor the value visitor implementation to visit the values with */ public void visitAllValuesWith(I_CmsXmlContentValueVisitor visitor) { List<String> bookmarks = new ArrayList<String>(getBookmarks()); Collections.sort(bookmarks); for (int i = 0; i < bookmarks.size(); i++) { String key = bookmarks.get(i); I_CmsXmlContentValue value = getBookmark(key); visitor.visit(value); } }
/** * Returns the list of sub-value for the given xpath in the selected locale.<p> * * @param path the xpath to look up the sub-value for * @param locale the locale to use * * @return the list of sub-value for the given xpath in the selected locale */ @Override public List<I_CmsXmlContentValue> getSubValues(String path, Locale locale) { List<I_CmsXmlContentValue> result = new ArrayList<I_CmsXmlContentValue>(); String bookmark = getBookmarkName(CmsXmlUtils.createXpath(path, 1), locale); int depth = CmsResource.getPathLevel(bookmark) + 1; Iterator<String> i = getBookmarks().iterator(); while (i.hasNext()) { String bm = i.next(); if (bm.startsWith(bookmark) && (CmsResource.getPathLevel(bm) == depth)) { result.add(getBookmark(bm)); } } if (result.size() > 0) { Collections.sort(result, COMPARE_INDEX); } return result; }