|
HTML Parser Home Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface NodeFactory
This interface defines the methods needed to create new nodes.
The factory is used when lexing to generate the nodes passed
back to the caller. By implementing this interface, and setting
that concrete object as the node factory for the
lexer
(perhaps via the
parser
), the way that nodes are generated
can be customized.
In general, replacing the factory with a custom factory is not required
because of the flexibility of the PrototypicalNodeFactory
.
Creation of Text and Remark nodes is straight forward, because essentially they are just sequences of characters extracted from the page. Creation of a Tag node requires that the attributes from the tag be remembered as well.
PrototypicalNodeFactory
Method Summary | |
---|---|
Remark |
createRemarkNode(Page page,
int start,
int end)
Create a new remark node. |
Text |
createStringNode(Page page,
int start,
int end)
Create a new text node. |
Tag |
createTagNode(Page page,
int start,
int end,
Vector attributes)
Create a new tag node. |
Method Detail |
---|
Text createStringNode(Page page, int start, int end) throws ParserException
page
- The page the node is on.start
- The beginning position of the string.end
- The ending positiong of the string.
ParserException
- If there is a problem encountered
when creating the node.Remark createRemarkNode(Page page, int start, int end) throws ParserException
page
- The page the node is on.start
- The beginning position of the remark.end
- The ending positiong of the remark.
ParserException
- If there is a problem encountered
when creating the node.Tag createTagNode(Page page, int start, int end, Vector attributes) throws ParserException
page
- The page the node is on.start
- The beginning position of the tag.end
- The ending positiong of the tag.attributes
- The attributes contained in this tag.
ParserException
- If there is a problem encountered
when creating the node.
|
© 2006 Derrick Oswald Sep 17, 2006
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
HTML Parser is an open source library released under Common Public License. |