public final class

GroupParser

extends Object
java.lang.Object
   ↳ chan.text.GroupParser

Class Overview

HTML text parser. Can work in two modes: linear and group.

In linear mode, parser will call onStartElement(GroupParser, String, String) every time parser reaches new tag. This method has boolean result, and when this method returns true - parser switches to group mode.

In group mode parser will handle all text inside started tag. Then it call onGroupComplete(GroupParser, String) with all text inside tag.

Summary

Nested Classes
interface GroupParser.Callback

Callback for GroupParser

Public Methods
String getAttr(String attrs, String attr)

Decodes attribute from encoded string.

void mark()

Stores parser's position.

static void parse(String source, GroupParser.Callback callback)

Starts a new parsing process.

void reset()

Resets parser's position to last marked one.

[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public String getAttr (String attrs, String attr)

Decodes attribute from encoded string. You can use it to handle attrs argument in onStartElement(GroupParser, String, String) method.

Parameters
attrs String: Encoded string.
attr String: Attribute name.
Returns
String Attribute value if it exists or null.

public void mark ()

Stores parser's position. Later you can come back with reset() method.

public static void parse (String source, GroupParser.Callback callback)

Starts a new parsing process.

Parameters
source String: String to parse.
callback GroupParser.Callback: Callback to handle parsed data.
Throws
ParseException when parsing process was interrupted.

public void reset ()

Resets parser's position to last marked one.