本文整理汇总了Java中org.htmlparser.tags.TableTag类的典型用法代码示例。如果您正苦于以下问题:Java TableTag类的具体用法?Java TableTag怎么用?Java TableTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TableTag类属于org.htmlparser.tags包,在下文中一共展示了TableTag类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: assertion
import org.htmlparser.tags.TableTag; //导入依赖的package包/类
private Assertion assertion() throws SyntaxError {
NodeList headerColumns = new NodeList();
headerColumns.add( new TableColumn() );
TableHeader tableHeader = new TableHeader();
tableHeader.setChildren( headerColumns );
NodeList rowColumns = new NodeList();
rowColumns.add( new TableColumn() );
TableRow tableRow = new TableRow();
tableRow.setChildren( rowColumns );
NodeList rows = new NodeList();
rows.add( tableHeader );
rows.add( tableRow );
TableTag tableTag = new TableTag();
tableTag.setChildren( rows );
TestPage testPage = new WikiTestPage( new WikiPageDummy());
SlimTestContext testContext = new SlimTestContextImpl( testPage );
Table table = new HtmlTable( tableTag );
List<SlimAssertion> list = new QueryTable( table, "id", testContext ).getAssertions();
return list.get( 0 );
}
开发者ID:ZsZs,项目名称:FitNesseLauncher,代码行数:21,代码来源:DelegatingResultsListenerTest.java
示例2: preencheMapaFeriadosEstaduais
import org.htmlparser.tags.TableTag; //导入依赖的package包/类
private void preencheMapaFeriadosEstaduais() throws IOException, ParserException,ParseException {
String estadosPage = recuperarDadosEstado();
StringBuilder stringBuilder = new StringBuilder(estadosPage);
stringBuilder.delete(0,estadosPage.indexOf("<h3"));
NodeList nodeEstadoList = filterTable(stringBuilder.toString());
String todosMeses[] = {"janeiro", "fevereiro", "março", "abril", "maio", "junho", "julho", "agosto", "setembro", "outubro", "novembro", "dezembro"};
Map<String,String> mapaMeses = new HashMap<String,String>();
int i = 1;
for (String mes:todosMeses){
String valor = String.valueOf(i++);
if(valor.length()< 2){
valor ="0"+valor;
}
mapaMeses.put(mes,valor);
}
String estado = null;
for (Node node:nodeEstadoList.toNodeArray()){
if(node instanceof TableTag){
NodeList lista = ((TableTag) node).searchFor(TableColumn.class, true);
SimpleNodeIterator iterator = lista.elements();
while (iterator.hasMoreNodes()){
Feriado feriado = new Feriado();
Node data = iterator.nextNode();
String[] dataExtenso = data.toPlainTextString().split(" de ");
feriado.setData(dataExtenso[0] + "/" + mapaMeses.get(dataExtenso[1]) + "/2015");
Node nome = iterator.nextNode();
feriado.setNome(nome.toPlainTextString());
Node lei = iterator.nextNode();
if(dataExtenso[0].length()==1){
dataExtenso[0] = "0"+dataExtenso[0];
}
System.out.println(dataExtenso[0] + "/" + mapaMeses.get(dataExtenso[1]) + "/2015,"+nome.toPlainTextString()+","+mapaEstados.get(estado));
mapaFeriadosEstado.get(estado).add(feriado);
}
}
if(node instanceof HeadingTag){
estado = node.getChildren().toHtml().trim();
if(node.getChildren().elementAt(0).getChildren() != null){
estado = node.getChildren().elementAt(0).getChildren().toHtml().trim();
}
mapaFeriadosEstado.put(estado,new ArrayList<Feriado>());
}
}
}
开发者ID:emivaljr,项目名称:hojenaoapp,代码行数:48,代码来源:MyEndpoint.java
示例3: visit
import org.htmlparser.tags.TableTag; //导入依赖的package包/类
/**
* 更新最新的部门发文
* @param httpConn
* @throws Exception
*/
public List visit(boolean isByCookie) throws Exception{
log4.info("======访问网站============cookie="+isByCookie);
String newUrls = null;
TableColumn[] arrColumns;
LinkTag lt = null;
String title, dates, codes, link;
HtmlPage page = null;
TableTag tableContent[] = null;
int order_count = 0;
List list = new LinkedList();
if(this.getUrl().startsWith("http:")){
newUrls = this.getUrl();
}
else{
if(this.base_url.endsWith("/")){
newUrls = this.base_url+"/"+this.getUrl();
}
else{
newUrls = this.base_url+this.getUrl();
}
}
// if(true){
// page = move2Urls(this.getHttpURLConnection(), newUrls);
// page.getBody().toHtml();
//// return page.getBody().toHtml();
// }
log4.info("newUrls="+newUrls);
String str = this.move2UrlsHtml(this.getHttpURLConnection(), newUrls, isByCookie);
String[] msgs = str.split("\n");
List htmls = new LinkedList();
for(String msg: msgs){
msg = msg.trim();
msg = msg.replaceAll(" ", "");
msg = msg.replaceAll("<", "");
msg = msg.replaceAll(">", "");
msg = msg.replaceAll(""", "");
msg = msg.replaceAll("td", "");
msg = msg.replaceAll("tr", "");
// msg = msg.replaceAll("&", "&");
// msg = msg.replaceAll("<", "<");
// msg = msg.replaceAll(">", ">");
// msg = msg.replaceAll("\"", """);
// msg = msg.replaceAll("'", "'");
if(!ErrorCode.isEmpty(msg)){
htmls.add(msg);
}
}
return htmls;
}
开发者ID:jview,项目名称:jtools,代码行数:62,代码来源:WebUtil.java
注:本文中的org.htmlparser.tags.TableTag类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论