ClassificationSearchNode extends DOMFragmentReader<Set<PatentClassification>> { @Override public Set<PatentClassification> read() { Set<PatentClassification> classifications = new HashSet<PatentClassification>(); List<Node> nationalN = parentPath.selectNodes("classification-national"); for (Node classNode : nationalN) { classifications.addAll(new ClassificationNationalNode(classNode).read()); } List<Node> cpcN = parentPath.selectNodes("classification-cpc-text|classification-cpc"); for (Node cpc : cpcN) { classifications.addAll(new ClassificationCpcNode(cpc, true).read()); } return classifications; } ClassificationSearchNode(Document document); @Override Set<PatentClassification> read();  }
@Test public void test() throws DocumentException { String xml = "<xml><us-field-of-classification-search>\r\n" + "<classification-national>\r\n" + "<country>US</country>\r\n" + "<main-classification>D 1100-130</main-classification>\r\n" + "<additional-info>unstructured</additional-info>\r\n" + "</classification-national>\r\n" + "<classification-national>\r\n" + "<country>US</country>\r\n" + "<main-classification>D 1199</main-classification>\r\n" + "</classification-national>\r\n" + "<classification-cpc-text>A21C 3/08</classification-cpc-text>\r\n" + "<classification-cpc-text>A21C 11/12</classification-cpc-text>\r\n" + "<classification-cpc-text>A21C 3/00</classification-cpc-text>\r\n" + "<classification-cpc-text>A21C 11/163</classification-cpc-text>\r\n" + "<classification-cpc-text>A21D 13/41</classification-cpc-text>\r\n" + "<classification-cpc-text>A21D 13/00</classification-cpc-text>\r\n" + "<classification-cpc-text>A21D 13/19</classification-cpc-text>\r\n" + "</us-field-of-classification-search></xml>"; Document doc = DocumentHelper.parseText(xml); Set<PatentClassification> clazs = new ClassificationSearchNode(doc).read(); SortedSet<PatentClassification> uspcClazs = PatentClassification.filterByType(clazs, ClassificationType.USPC); assertEquals("D 1100-130", uspcClazs.iterator().next().getTextOriginal()); SortedSet<PatentClassification> cpcClazs = PatentClassification.filterByType(clazs, ClassificationType.CPC); assertEquals(7, cpcClazs.size()); }