/** * Finds a text node, however embedded it might be, and returns * it. The text node will retain links to its parents, so * further navigation is possible. * @param searchText The text to search for. * @return The list of text nodes (recursively) found. */ public Text[] digupStringNode(String searchText) { NodeList nodeList = searchFor(searchText); NodeList stringNodes = new NodeList(); for (int i=0;i<nodeList.size();i++) { Node node = nodeList.elementAt(i); if (node instanceof Text) { stringNodes.add(node); } else { if (node instanceof CompositeTag) { CompositeTag ctag = (CompositeTag)node; Text[] nodes = ctag.digupStringNode(searchText); for (int j=0;j<nodes.length;j++) stringNodes.add(nodes[j]); } } } Text[] stringNode = new Text[stringNodes.size()]; for (int i=0;i<stringNode.length;i++) { stringNode[i] = (Text)stringNodes.elementAt(i); } return stringNode; }
/** * Finds a text node, however embedded it might be, and returns * it. The text node will retain links to its parents, so * further navigation is possible. * @param searchText The text to search for. * @return The list of text nodes (recursively) found. */ public Text[] digupStringNode(String searchText) { NodeList nodeList = searchFor(searchText); NodeList stringNodes = new NodeList(); for (int i=0;i<nodeList.size();i++) { Node node = nodeList.elementAt(i); if (node instanceof Text) { stringNodes.add(node); } else { if (node instanceof CompositeTag) { CompositeTag ctag = (CompositeTag)node; Text[] nodes = ctag.digupStringNode(searchText); for (int j=0;j<nodes.length;j++) stringNodes.add(nodes[j]); } } } Text[] stringNode = new Text[stringNodes.size()]; for (int i=0;i<stringNode.length;i++) { stringNode[i] = (Text)stringNodes.elementAt(i); } return stringNode; }