I have used Jtidy parser in java to fetch the title text.
String titleText=null;
try {
titleText = doc.getElementsByTagName("title").item(0)
.getFirstChild().getNodeValue();
} catch (Exception e1) {
try {
titleText = doc.getElementsByTagName("title").item(1)
.getFirstChild().getNodeValue();
} catch (Exception e2) {
try {
titleText = doc.getElementsByTagName("title").item(2)
.getFirstChild().getNodeValue();
} cathc (...)
}
}
above code is working fine,It is reading title at 0'th index,if not found then at 1'st index,and then at 2'nd index.But here I am getting issue:-for some page,title text is present at mid of page or below that,so this code is not working for such pages.In this way,for such condition, length of program is getting increased.Is there any other solution,which will read the title from entire page in one go?.Please help me.