void lookup(String text) { NodeList nl = DOMInfoExtractor.locateNodes(document, ".//text()[contains(.,'" + text + "')]"); System.out.println("find " + nl.getLength() + " items"); FoundItem[] fis = new FoundItem[nl.getLength()]; for (int i = 0; i < nl.getLength(); i++) { fis[i] = getFoundItem(nl.item(i), text); } foundList.setListData(fis); }
void lookupByXPath(String xpath) { NodeList nl = DOMInfoExtractor.locateNodes(document, xpath); System.out.println("lookupByXPath: " + xpath); if (nl == null) { JOptionPane.showMessageDialog(this, "error xpath: " + xpath); } System.out.println("find " + nl.getLength() + " items"); FoundItem[] fis = new FoundItem[nl.getLength()]; for (int i = 0; i < nl.getLength(); i++) { fis[i] = getFoundItem(nl.item(i), null); } foundList.setListData(fis); }
/** called when our JTree's nodes are selected. */ void nodeSelected(TreeNode treeNode) { lastSelected = treeNode; Node node = jtree.getNode(treeNode); if (node == null) return; String xpath = DOMInfoExtractor.getXPath(node); selectedXPathTextField.setText(xpath); String message = DOMTreeFull.toString(node); message += "\r\n"; message += xpath; setMessage(message); }
private String compress(String s) { StringBuffer sb = new StringBuffer(); try { BufferedReader br = new BufferedReader(new StringReader(s)); String line; while ((line = br.readLine()) != null) { if (line.length() != 0) { sb.append(DOMInfoExtractor.filter(line)); sb.append(RETURN); } } } catch (IOException e) { } ; return sb.toString(); }