最近、JavaでHTMLソースの情報を取得したいです。基本的なニーズは、HTMLのメインコンテンツ領域を取得することです。たとえば、次はHTMLソースです。
<html>
<head>
<tilte>
chinese charactor --中文
<title>
</head>
<body>
<div>
this is something area including Chinese charactor.,like meun I don't need,
</div>
<div>
this is something area including Chinese charactor,like ads I don't need,
</div>
<div>
this is main content, include the content I need. almost every content is filled by many Chinese charactor.Like: 好好学习,天天向上。 我爱stackoverflow.谢谢你的帮助,非常感谢!
</div>
<div>
this is foot area, also including Chinese charactor ,but I don't need.
</div>
</body>
</html>
このHTMLソースは単純なものです。多くの異なった複雑な情報源があります。メインコンテンツを含むdivまたはその他の要素領域をjavaで解析したいと思います。私が欲しい結果は次のとおりです。
<div>
This is main content, include the content I need. almost every content is filled by many Chinese character like: 好好学习,天天向上。 我爱stackoverflow.谢谢你的帮助,非常感谢!
</div>
内容が異なる何万ものdivがあり、dividは不明または異なります。divには、pタグなど、さまざまな条件があります。漢字の見た目や分布を判断して内容を解析する方法はありますか?