extractPaths.add(pathParser.toPath(list.get(i)).toString());
}
}
private void searchDataNode(HTMLNode root) {*/
NodePathParser pathParser = new NodePathParser();
NodeIterator iterator = root.iterator();
while(iterator.hasNext()) {
HTMLNode node = iterator.next();
if(!node.isNode(Name.DIV)) continue;
Attributes attributes = node.getAttributes();
Attribute attribute = attributes.get("id");
if(attribute == null) continue;
String value = attribute.getValue();
if(value == null) continue;
if("posts".equalsIgnoreCase(value)) {
HTMLNode titleNode = searchTitleNode(root, node);
if(titleNode != null) {
titlePath = titleNode.getName()+"[0]";
extractPaths.add(pathParser.toPath(titleNode).toString());
}
HTMLNode pageNode = searchPageNode(node);
if(pageNode == null) pageNode = searchPageNode2(root);
if(pageNode != null) {
pagePath = "TABLE[0]";
extractPaths.add(pathParser.toPath(pageNode).toString());
}
String threadPath = pathParser.toPath(node).toString();
HTMLNode userNode = searchUserNode(node);
if(userNode != null) {
userPath = pathParser.toPath(userNode).toString();
String path = userPath.substring(threadPath.length());
int index = path.indexOf('[');
if(index > -1) {
path = path.substring(0, index+1) + "*" + path.substring(index+2, path.length());
}
if(titleNode != null && titleNode.isNode(Name.DIV)) {
userPath = "DIV[1]" + path;
} else {
userPath = "DIV[0]" + path;
}
index = userPath.lastIndexOf("TD[");
if(index > 0) {
int end = userPath.indexOf(']', index);
if(end > 0) {
userPath = userPath.substring(0, index+3) + "i<2"+ userPath.substring(end);
}
}
}
if(userPath == null) return;
HTMLNode postNode = searchContentNode(node, "post_message");
if(postNode != null) {
postPath = pathParser.toPath(postNode).toString();
String path = postPath.substring(threadPath.length());
int index = path.indexOf('[');
if(index > -1) {
path = path.substring(0, index+1) + "*" + path.substring(index+2, path.length());