org.encog.parse.tags.read
Class ReadTags

java.lang.Object
  extended by org.encog.parse.tags.read.ReadTags
Direct Known Subclasses:
ReadHTML, ReadXML

public class ReadTags
extends Object

Base class used to read tags. This base class is used by both the XML and HTML parsing.

Author:
jheaton

Field Summary
static int CHAR_BULLET
          The bullet character.
static int CHAR_TRADEMARK
          The bullet character.
static int MAX_LENGTH
          Maximum length string to read.
 
Constructor Summary
ReadTags(InputStream is)
          The constructor should be passed an InputStream that we will parse from.
 
Method Summary
protected  void eatWhitespace()
          Remove any whitespace characters that are next in the InputStream.
 Tag getTag()
          Return the last tag found, this is normally called just after the read function returns a zero.
 boolean is(String name, boolean start)
          Checks to see if the next tag is the tag specified.
protected  String parseAttributeName()
          Parse an attribute name, if one is present.
protected  String parseString()
          Called to parse a double or single quote string.
protected  void parseTag()
          Called when a tag is detected.
 int read()
          Read a single character from the HTML source, if this function returns zero(0) then you should call getTag to see what tag was found.
 boolean readToTag()
          Read until we reach the next tag.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CHAR_BULLET

public static final int CHAR_BULLET
The bullet character.

See Also:
Constant Field Values

CHAR_TRADEMARK

public static final int CHAR_TRADEMARK
The bullet character.

See Also:
Constant Field Values

MAX_LENGTH

public static final int MAX_LENGTH
Maximum length string to read.

See Also:
Constant Field Values
Constructor Detail

ReadTags

public ReadTags(InputStream is)
The constructor should be passed an InputStream that we will parse from.

Parameters:
is - An InputStream to parse from.
Method Detail

eatWhitespace

protected void eatWhitespace()
Remove any whitespace characters that are next in the InputStream.


getTag

public Tag getTag()
Return the last tag found, this is normally called just after the read function returns a zero.

Returns:
The last HTML tag found.

is

public boolean is(String name,
                  boolean start)
Checks to see if the next tag is the tag specified.

Parameters:
name - The name of the tag desired.
start - True if a starting tag is desired.
Returns:
True if the next tag matches these criteria.

parseAttributeName

protected String parseAttributeName()
Parse an attribute name, if one is present.

Returns:
Return the attribute name, or null if none present.

parseString

protected String parseString()
Called to parse a double or single quote string.

Returns:
The string parsed.

parseTag

protected void parseTag()
Called when a tag is detected. This method will parse the tag.


read

public int read()
Read a single character from the HTML source, if this function returns zero(0) then you should call getTag to see what tag was found. Otherwise the value returned is simply the next character found.

Returns:
The character read, or zero if there is an HTML tag. If zero is returned, then call getTag to get the next tag.

readToTag

public boolean readToTag()
Read until we reach the next tag.

Returns:
True if a tag was found, false on EOF.

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2014. All Rights Reserved.