From: SourceForge.net <no...@so...> - 2010-06-28 16:13:01
|
Bugs item #3022414, was opened at 2010-06-28 16:13 Message generated for change (Tracker Item Submitted) made by nobody You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=113153&aid=3022414&group_id=13153 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: DOM Support Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: getNodeValue() returning "value" for empty string Initial Comment: The fix for bug 2922337 made in revision 1094 looks to have introduced a problem parsing/retrieving empty string values. After parsing, the getNodeValue() method seems to return a value of "value" instead of empty string. For example, StringReader inReader = new StringReader(strHTML); Tidy tidy = new Tidy(); tidy.setShowWarnings(false); Document doc = tidy.parseDOM(inReader, null); Where strHTML contains... <input type="text" name="TEXT1" id="TEXT1" value="" maxlength="255" class="ltext" /> Using the getNodeValue() on the input node within the returned DOM returns "value" rather than "" node.getAttributes().getNamedItem("value").getNodeValue() Changing line 658 of the getString() function within TidyUtils.java to return an emptry string rather than null seems to prevent the problem: return length == 0 ? "" : new String(bytes, offset, Math.min(length, bytes.length - offset), "UTF8"); Seen in revision 1094 onwards. Revision 938 does not have this problem. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=113153&aid=3022414&group_id=13153 |