Element (Map<String, Element> categoryMap, Element rootElement, IntentionActionMetaData metaData, String key, int idx) { Element element = categoryMap.get(key); if (element == null) { element = new Element("category"); element.setAttribute("name", metaData.myCategory[idx]); categoryMap.put(key, element); if (idx == 0) { rootElement.addContent(element); } else { getCategoryElement(categoryMap, rootElement, metaData, StringUtil.join(metaData.myCategory, 0, metaData.myCategory.length - 1, "."), idx - 1).addContent(element); } } return element; }