public abstract class IParser extends Object
铭飞科技
Copyright: Copyright (c) 2014 - 2015
Comments:基于模板方法模式,抽出通用标签解析父类,
Create Date:2015-4-18
Modification history:
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
DO_SUFFIX
.do后缀
|
static String |
HTM_SUFFIX
htm后缀
|
static String |
HTML_SUFFIX
html后缀
|
protected String |
htmlCotent
原始html内容
|
protected String |
mobilePath |
protected String |
newCotent
替换后的html内容
|
protected static String |
PROPERTY_VALUE
定位标签中属性的值
|
protected static String |
PRORETY_NAME
定位标签中属性的名称
|
| 构造器和说明 |
|---|
IParser() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected static int |
count(String source,
String regex)
查询规则匹配次数
|
String |
getNewCotent() |
Map<String,String> |
getProperty(String regex)
取出栏目标签中的属性
|
abstract String |
parse()
标签替换的抽象方法
|
protected static List<String> |
parseAll(String source,
String regex,
int find)
返回所有匹配的结果,并且是find组
|
protected static String |
parseFirst(String source,
String regex,
int find)
返回第一次匹配的结果,并且是find组
|
String |
replaceAll(String regex)
用该内容替换所有当前标签
|
String |
replaceAll(String content,
String regex)
用该内容替换所有当前标签
|
String |
replaceFirst(String regex)
用该内容替换第一个当前找到的第一个标签
|
void |
setNewCotent(String newCotent) |
protected String htmlCotent
protected String mobilePath
protected String newCotent
protected static int count(String source, String regex)
source - 模版regex - 标签protected static List<String> parseAll(String source, String regex, int find)
source - 模版regex - 规则find - 第几组protected static String parseFirst(String source, String regex, int find)
source - 模版regex - 标签find - public String getNewCotent()
public abstract String parse()
public String replaceAll(String content, String regex)
content - 新内容regex - 正则public String replaceFirst(String regex)
htmlCotent - 源内容newCotent - 替换内容regex - 替换规则,更具RegexEnumpublic void setNewCotent(String newCotent)
Copyright © 2016. All rights reserved.