// TOC
Map<String, List<URL>> mapUrls = getResources(locale + "/help/index.xml");
// Get our parser...
ConfigParser parser = new ConfigParser(habitat);
// Setup a new "merged" TOC...
mergedIndex = new Index();
mergedIndex.setIndexItems(new ArrayList<IndexItem>());
mergedIndex.setVersion("2.0");
// Loop through the urls and add them all
String id = null; // module id
String prefix = "/" + locale + "/help/"; // prefix (minus module id)
List<URL> urls = null; // URLs to TOC files w/i each plugin module
for (Map.Entry<String, List<URL>> entry : mapUrls.entrySet()) {
id = entry.getKey();
urls = entry.getValue();
for (URL url : urls) {
DomDocument doc = parser.parse(url);
// Merge all the TOC's...
Index index = (Index) doc.getRoot().get();
for (IndexItem item : index.getIndexItems()) {
insertIndexItem(mergedIndex.getIndexItems(), item, id + prefix);