See: Description
Class | Description |
---|---|
AbstractNodeDecorator | Deprecated
Use direct subclasses or dynamic proxies instead.
|
DecodingNode | Deprecated
Use direct subclasses or dynamic proxies instead.
|
EscapeCharacterRemovingNode | Deprecated
Use direct subclasses or dynamic proxies instead.
|
NonBreakingSpaceConvertingNode | Deprecated
Use direct subclasses or dynamic proxies instead.
|
Deprecated. Use either prototypes or dynamic proxies instead.
Use either direct subclasses of the appropriate node and set them on the
PrototypicalNodeFactory
,
or use a dynamic proxy implementing the required node type interface.
The nodeDecorators package contains example decorators that alter node behaviour. For example, the DecodingNode class overrides the toPlainTextString() method of all nodes it wraps and applies the Translate class decode() method to the original node output:
StringBuffer content = new StringBuffer (1024); StringNodeFactory factory = new StringNodeFactory (); factory.setDecode (true); createParser ("http://whatever"); parser.setNodeFactory (factory); NodeIterator iterator = parser.elements (); while (iterator.hasMoreNodes ()) content.append (iterator.nextNode ().toPlainTextString ()); System.out.println (content.toString ());Decorators are a powerful way of performing the same operation on every node.
StringNodeFactory
,
AbstractNodeDecorator
HTML Parser is an open source library released under LGPL.