Document doc = Jsoup.parseBodyFragment(previewHtml); //html内容解析为Document
int index = 0;
StringBuffer stringBuffer = new StringBuffer();
Elements inputArray = doc.getElementsByTag("input");//对应的元素数组
for(int a=0;a<inputArray.size(); a++) {
Element element = inputArray.get(a);
String type = element.attr("type"); //获取元素属性的值
String field = element.attr("name");
if("text".equals(type) && index<3) {
String title = element.attr("title");
stringBuffer.append("{field:'"+field+"',title:'"+title+"',width:100,align:'center'},");
index++;
} else break;
}
System.out.println(stringBuffer);

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-19
  • 2022-02-25
  • 2022-12-23
  • 2021-10-23
  • 2022-01-14
猜你喜欢
  • 2022-12-23
  • 2021-12-27
  • 2022-12-23
  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案