This class is capable of reading textual data and recognizing certain
parts of that text beginning with a 'magic' character. The default
character used is '<'. All parts of the text are returned as
I_Element s. The class allows to register certain element classes
for tag starts.
Not recognized parts are returned as an instance of the default
element class.
author: Hendrik Schreiber version: 1.1beta1 $Id: Parser.java,v 1.9 2005/07/06 18:31:00 hendriks73 Exp $
Creates a new Parser.
Parameters: aURL - the URL is opened and the resulting InputStream iswrapped with an InputputStreamReader using the default encoding
Creates a new Parser.
Parameters: aURL - the URL is opened and the resulting InputStream iswrapped with an InputputStreamReader using the specified encoding Parameters: anEncoding - the way data is encoded
Registers an Element class.
Parameters: anElementClass - an Element class throws: ParserException - if the class does not have a method called "getTagStart"
Returns the URL this parser is parsing. Note that this must
have been set explicitly using
Parser.setURL unless you
used the appropriate constructor.
the URL this Parser is parsing.
Order TagStarts and ElementClasses to get the longest match first.
setDefaultElementClass
public void setDefaultElementClass(Constructor aDefaultElementConstructor)(Code)
Sets the default element Constructor. The default value for this is
RawDataElement .
Parameters: aDefaultElementConstructor - the default element Constructor See Also:Parser.getDefaultElementConstructor()