Java Reference
In-Depth Information
capture = false;
buffer.setLength(0);
If the tag is an ending table row tag, </tr> , then we can display the row we just ex-
tracted. This display is handled by the processTableRow method.
} else if (tag.getName().equalsIgnoreCase("/tr"))
{
if (list.size() > 0)
{
processTableRow(list);
list.clear();
}
If the tag is an opening table column tag, <td> , begin capturing the data contained in
that column.
} else if (tag.getName().equalsIgnoreCase("td"))
{
if (buffer.length() > 0)
list.add(buffer.toString());
buffer.setLength(0);
capture = true;
If the tag is an ending table column tag, </td> , then we have captured one complete
column. Add that column to the row's list and stop capturing text.
} else if (tag.getName().equalsIgnoreCase("/td"))
{
list.add(buffer.toString());
buffer.setLength(0);
capture = false;
Finally, if we reach an ending table tag, </table> , then we are done.
} else if (tag.getName().equalsIgnoreCase("/table"))
{
break;
}
} else
{
When characters are encountered while we are capturing, we should append them to the
buffer .
if (capture)
buffer.append((char) ch);
Once the loop ends, the entire amortization table will be parsed.
Search WWH ::




Custom Search