public void process(StructNode sectionNode) throws IOException { if (sectionNode.getChildNodes() != null) { String sectionName = sectionNode.getName().substring(1, sectionNode.getName().length() - 1).trim(); PageSection section = findSection(sectionName); if (section == null) { section = new PageSection(sectionName); if (parentSection != null) { parentSection.addSubSection(section); } else { pageSpecHandler.addSection(section); } } processSection(section, sectionNode.getChildNodes()); } }
private void processSectionRule(PageSection section, StructNode ruleNode) throws IOException { String ruleText = ruleNode.getName().substring(1).trim(); Pair<PageRule, Map<String, String>> rule = findAndProcessRule(ruleText, ruleNode); PageSection ruleSection = new PageSection(ruleText); section.addSubSection(ruleSection); List<StructNode> resultingNodes; try { resultingNodes = rule.getKey().apply(pageSpecHandler, ruleText, NO_OBJECT_NAME, rule.getValue()); } catch (Exception ex) { throw new SyntaxException(ruleNode, "Error processing custom rule", ex); } processSection(ruleSection, resultingNodes); }