public static void test_remove(DConfigBean config, DDBean dd) { try { System.out.println(config.getXpaths().length + " xpaths."); String targetXPath = config.getXpaths()[0]; System.out.println(targetXPath + " is the first."); DDBean first = dd.getChildBean(targetXPath)[0]; DConfigBean cnfg = config.getDConfigBean(first); System.out.println("cnfg has " + cnfg.getXpaths().length + " sub kids"); config.removeDConfigBean(cnfg); System.out.println("cnfg has " + cnfg.getXpaths().length + " sub kids"); System.out.println(config.getXpaths().length + " xpaths."); } catch (Exception e) { System.out.println("ERROR: " + e.getMessage()); e.printStackTrace(); } }
public static void traverse(DConfigBean config, DDBean dd, int indent) throws ConfigurationException { indent += 3; indentPrint(indent, "starting \"" + dd.getXpath() + "\", config of type " + trimClass(config.getClass())); String[] pathsToFollow = config.getXpaths(); if (pathsToFollow.length > 0) indentPrint(indent, "- There are " + pathsToFollow.length + " xpaths returned."); indent += 4; for (int i = 0; i < pathsToFollow.length; i++) { String s = "path " + i + ": " + pathsToFollow[i]; DDBean[] lesserBeans = dd.getChildBean(pathsToFollow[i]); indentPrint(indent, s + " , " + lesserBeans.length + " found."); for (int j = 0; j < lesserBeans.length; j++) { DConfigBean cb = config.getDConfigBean(lesserBeans[j]); traverse(cb, lesserBeans[j], indent); } } }
public static void traverse(DConfigBean config, DDBean dd, int indent) throws ConfigurationException { indent += 3; indentPrint(indent, "starting \"" + dd.getXpath() + "\", config of type " + trimClass(config.getClass())); String[] pathsToFollow = config.getXpaths(); if (pathsToFollow.length > 0) indentPrint(indent, "- There are " + pathsToFollow.length + " xpaths returned."); indent += 4; for (int i = 0; i < pathsToFollow.length; i++) { String s = "path " + i + ": " + pathsToFollow[i]; DDBean[] lesserBeans = dd.getChildBean(pathsToFollow[i]); indentPrint(indent, s + " , " + lesserBeans.length + " found."); for (int j = 0; j < lesserBeans.length; j++) { DConfigBean cb = config.getDConfigBean(lesserBeans[j]); traverse(cb, lesserBeans[j], indent); } } }
public static void test_remove(DConfigBean config, DDBean dd) { try { System.out.println(config.getXpaths().length + " xpaths."); String targetXPath = config.getXpaths()[0]; System.out.println(targetXPath + " is the first."); DDBean first = dd.getChildBean(targetXPath)[0]; DConfigBean cnfg = config.getDConfigBean(first); System.out.println("cnfg has " + cnfg.getXpaths().length + " sub kids"); config.removeDConfigBean(cnfg); System.out.println("cnfg has " + cnfg.getXpaths().length + " sub kids"); System.out.println(config.getXpaths().length + " xpaths."); } catch (Exception e) { System.out.println("ERROR: " + e.getMessage()); e.printStackTrace(); } }