[Htmlparser-cvs] htmlparser/src/org/htmlparser Parser.java,1.47,1.48 StringNode.java,1.25,1.26
Brought to you by:
derrickoswald
From: <jke...@us...> - 2003-06-25 05:03:12
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser In directory sc8-pr-cvs1:/tmp/cvs-serv2842/src/org/htmlparser Modified Files: Parser.java StringNode.java Log Message: added non breaking space converting decorator Index: Parser.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/Parser.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** Parser.java 25 Jun 2003 03:46:37 -0000 1.47 --- Parser.java 25 Jun 2003 05:03:08 -0000 1.48 *************** *** 194,197 **** --- 194,203 ---- */ private boolean shouldRemoveEscapeCharacters = false; + + /** + * Flag to tell the parser to convert non breaking space + * (i.e. \u00a0) to a space (" "). If true, this will happen inside StringNode's toPlainTextString. + */ + private boolean shouldConvertNonBreakingSpace = false; /** *************** *** 1239,1241 **** --- 1245,1256 ---- return shouldRemoveEscapeCharacters; } + + public void setNonBreakSpaceConversion(boolean shouldConvertNonBreakSpace) { + this.shouldConvertNonBreakingSpace = shouldConvertNonBreakSpace; + } + + public boolean shouldConvertNonBreakingSpace() { + return shouldConvertNonBreakingSpace; + } + } Index: StringNode.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/StringNode.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** StringNode.java 25 Jun 2003 03:56:20 -0000 1.25 --- StringNode.java 25 Jun 2003 05:03:08 -0000 1.26 *************** *** 60,64 **** public static Node createStringNode( StringBuffer textBuffer, int textBegin, int textEnd, ! boolean shouldDecode, boolean shouldRemoveEscapeCharacters) { Node newNode = new StringNode(textBuffer, textBegin, textEnd); if (shouldDecode) --- 60,65 ---- public static Node createStringNode( StringBuffer textBuffer, int textBegin, int textEnd, ! boolean shouldDecode, boolean shouldRemoveEscapeCharacters, ! boolean shouldConvertNonBlankSpace) { Node newNode = new StringNode(textBuffer, textBegin, textEnd); if (shouldDecode) *************** *** 66,69 **** --- 67,72 ---- if (shouldRemoveEscapeCharacters) newNode = new EscapeCharacterRemovingNode(newNode); + if (shouldConvertNonBlankSpace) + newNode = new NonBreakingSpaceConvertingNode(newNode); return newNode; } |