1 27 package org.htmlparser; 28 29 import java.io.Serializable ; 30 import org.htmlparser.lexer.Page; 31 32 import org.htmlparser.nodeDecorators.DecodingNode; 33 import org.htmlparser.nodeDecorators.EscapeCharacterRemovingNode; 34 import org.htmlparser.nodeDecorators.NonBreakingSpaceConvertingNode; 35 36 public class StringNodeFactory 37 extends 38 PrototypicalNodeFactory 39 implements 40 Serializable 41 { 42 46 protected boolean mDecode; 47 48 49 53 protected boolean mRemoveEscapes; 54 55 59 protected boolean mConvertNonBreakingSpaces; 60 61 public StringNodeFactory () 62 { 63 mDecode = false; 64 mRemoveEscapes = false; 65 mConvertNonBreakingSpaces = false; 66 } 67 68 72 78 public Text createStringNode (Page page, int start, int end) 79 { 80 Text ret; 81 82 ret = super.createStringNode (page, start, end); 83 if (getDecode ()) 84 ret = new DecodingNode (ret); 85 if (getRemoveEscapes ()) 86 ret = new EscapeCharacterRemovingNode (ret); 87 if (getConvertNonBreakingSpaces ()) 88 ret = new NonBreakingSpaceConvertingNode (ret); 89 90 return (ret); 91 } 92 93 97 public void setDecode (boolean decode) 98 { 99 mDecode = decode; 100 } 101 102 106 public boolean getDecode () 107 { 108 return (mDecode); 109 } 110 111 115 public void setRemoveEscapes (boolean remove) 116 { 117 mRemoveEscapes = remove; 118 } 119 120 124 public boolean getRemoveEscapes () 125 { 126 return (mRemoveEscapes); 127 } 128 129 133 public void setConvertNonBreakingSpaces (boolean convert) 134 { 135 mConvertNonBreakingSpaces = convert; 136 } 137 138 142 public boolean getConvertNonBreakingSpaces () 143 { 144 return (mConvertNonBreakingSpaces); 145 } 146 } 147 | Popular Tags |