cn.wanghaomiao.xpath.util.EmMap Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of JsoupXpath Show documentation
Show all versions of JsoupXpath Show documentation
一个非常好用而且强大的基于xpath的html解析器。html的DOM树生成依赖Jsoup。Lexer 和 Parser基于Antlr4,支持完备的W3C XPATH 1.0标准语法,W3C规范:http://www.w3.org/TR/1999/REC-xpath-19991116。
package cn.wanghaomiao.xpath.util;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
* @author 汪浩淼 [ [email protected] ]
* @since 14-3-11 下午6:00
*/
public class EmMap {
public Map scopeEmMap = new HashMap();
public Map opEmMap = new HashMap();
public Set commOpChar = new HashSet();
private static EmMap ourInstance = new EmMap();
public static EmMap getInstance() {
return ourInstance;
}
private EmMap() {
scopeEmMap.put("/",ScopeEm.INCHILREN);
scopeEmMap.put("//",ScopeEm.RECURSIVE);
scopeEmMap.put("./",ScopeEm.CUR);
scopeEmMap.put(".//",ScopeEm.CURREC);
opEmMap.put("+",OpEm.PLUS);
opEmMap.put("-",OpEm.MINUS);
opEmMap.put("=",OpEm.EQ);
opEmMap.put("!=",OpEm.NE);
opEmMap.put(">",OpEm.GT);
opEmMap.put("<",OpEm.LT);
opEmMap.put(">=",OpEm.GE);
opEmMap.put("<=",OpEm.LE);
opEmMap.put("^=",OpEm.STARTWITH);
opEmMap.put("$=",OpEm.ENDWITH);
opEmMap.put("*=",OpEm.CONTAIN);
opEmMap.put("~=",OpEm.REGEX);
commOpChar.add('+');
commOpChar.add('-');
commOpChar.add('=');
commOpChar.add('*');
commOpChar.add('^');
commOpChar.add('$');
commOpChar.add('~');
commOpChar.add('>');
commOpChar.add('<');
commOpChar.add('!');
}
}