HTML Parser Home Page

org.htmlparser
Class StringNodeFactory

java.lang.Object
  extended byorg.htmlparser.PrototypicalNodeFactory
      extended byorg.htmlparser.StringNodeFactory
All Implemented Interfaces:
NodeFactory, Serializable

public class StringNodeFactory
extends PrototypicalNodeFactory
implements Serializable

See Also:
Serialized Form

Field Summary
protected  boolean mConvertNonBreakingSpaces
          Flag to tell the parser to convert non breaking space (from   to a space " ").
protected  boolean mDecode
          Flag to tell the parser to decode strings returned by StringNode's toPlainTextString.
protected  boolean mRemoveEscapes
          Flag to tell the parser to remove escape characters, like \n and \t, returned by StringNode's toPlainTextString.
 
Fields inherited from class org.htmlparser.PrototypicalNodeFactory
mBlastocyst
 
Constructor Summary
StringNodeFactory()
           
 
Method Summary
 Node createStringNode(Page page, int start, int end)
          Create a new string node.
 boolean getConvertNonBreakingSpaces()
          Get the non-breaking space replacing state.
 boolean getDecode()
          Get the decoding state.
 boolean getRemoveEscapes()
          Get the escape removing state.
 void setConvertNonBreakingSpaces(boolean convert)
          Set the non-breaking space replacing state.
 void setDecode(boolean decode)
          Set the decoding state.
 void setRemoveEscapes(boolean remove)
          Set the escape removing state.
 
Methods inherited from class org.htmlparser.PrototypicalNodeFactory
clear, createRemarkNode, createTagNode, get, put, registerTag, registerTags, remove, unregisterTag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mDecode

protected boolean mDecode
Flag to tell the parser to decode strings returned by StringNode's toPlainTextString. Decoding occurs via the method, org.htmlparser.util.Translate.decode()


mRemoveEscapes

protected boolean mRemoveEscapes
Flag to tell the parser to remove escape characters, like \n and \t, returned by StringNode's toPlainTextString. Escape character removal occurs via the method, org.htmlparser.util.ParserUtils.removeEscapeCharacters()


mConvertNonBreakingSpaces

protected boolean mConvertNonBreakingSpaces
Flag to tell the parser to convert non breaking space (from   to a space " "). If true, this will happen inside StringNode's toPlainTextString.

Constructor Detail

StringNodeFactory

public StringNodeFactory()
Method Detail

createStringNode

public Node createStringNode(Page page,
                             int start,
                             int end)
Create a new string node.

Specified by:
createStringNode in interface NodeFactory
Overrides:
createStringNode in class PrototypicalNodeFactory
Parameters:
page - The page the node is on.
start - The beginning position of the string.
end - The ending positiong of the string.

setDecode

public void setDecode(boolean decode)
Set the decoding state.

Parameters:
decode - If true, string nodes decode text using Translate.decode(java.lang.String).

getDecode

public boolean getDecode()
Get the decoding state.

Returns:
true if string nodes decode text.

setRemoveEscapes

public void setRemoveEscapes(boolean remove)
Set the escape removing state.

Parameters:
remove - If true, string nodes remove escape characters.

getRemoveEscapes

public boolean getRemoveEscapes()
Get the escape removing state.

Returns:
The removing state.

setConvertNonBreakingSpaces

public void setConvertNonBreakingSpaces(boolean convert)
Set the non-breaking space replacing state.

Parameters:
convert - If true, string nodes replace ;nbsp; characters with spaces.

getConvertNonBreakingSpaces

public boolean getConvertNonBreakingSpaces()
Get the non-breaking space replacing state.

Returns:
The replacing state.

© 2004 Somik Raha
Mar 14, 2004

HTML Parser is an open source library released under LGPL.
SourceForge.net