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); }