toHtml(verbatim) doesn't work correctly
Brought to you by:
derrickoswald
If verbatim == true, then toHtml(verbatim) should return as close to the original page text as possible. Setting verbatim == true should make toHtml(verbatim) ignore all virtual end tags created by the parser. However, the toHtml(verbatim) method only ignores virtual end tags for top level composite tag.
If you use html parser to parse the html file I provided and use toHTML(true) to reproduce this file, you will notice that toHTML(true) will print the virtual end tags.
Here is my proposed fix.
In CompositeTag.java
protected void putChildrenInto (StringBuffer sb, boolean verbatim)
{
Node node;
for (SimpleNodeIterator e = children (); e.hasMoreNodes ();)
{
node = e.nextNode ();
// eliminate virtual tags
// Hou Kot Edited 04-26-2009
// original
/*
if (!verbatim || !(node.getStartPosition () == node.getEndPosition ()))
sb.append (node.toHtml ());
*/
if (!verbatim || !(node.getStartPosition () == node.getEndPosition ()))
sb.append (node.toHtml (verbatim));
// Hou Kot Edited 04-26-2009
}
}