Stellent
HowToComponents
JavaDoc

intradoc.common
Class Parser

java.lang.Object
  |
  +--intradoc.common.Parser

public class Parser
extends java.lang.Object

Class performs basic parsing activities. In particular it is smart about finding HTML tags and server side scripting elements.


Constructor Summary
Parser()
           
 
Method Summary
static java.lang.String findAnyTag(java.io.Reader reader, ParseOutput parseOutput)
          Finds non-specified html tags.
static boolean findCharacter(java.io.Reader reader, ParseOutput parseOutput, char ch, boolean noStop)
          Searches through an input reader for a particular character.
static int findCharacters(java.io.Reader reader, ParseOutput parseOutput, char[] chs, boolean noStop)
          Version of service that finds a match for one of a list of characters.
static int findCharactersEx(java.io.Reader reader, ParseOutput parseOutput, char[] chs, char[] startCheck, boolean noStop)
          Version of service that finds a match for one of a list of characters.
static boolean findGenericTagPrefix(java.io.Reader reader, ParseOutput parseOutput, char[] beginChars, char[] endChars, char[] tag)
          Looks for a general tag prefix where the first character can be any of a set of characters and the last character can be any of a set of characters.
static int findHtmlPrefixTags(java.io.Reader reader, ParseOutput parseOutput, char[][] tags)
          Looks for a match in an array of strings.
static boolean findHtmlTagPrefix(java.io.Reader reader, ParseOutput parseOutput, char[] tag)
          Looks for a string of the form
static boolean findScriptTag(java.io.Reader reader, ParseOutput parseOutput, char ch)
          Looks for script tag.
protected static int removeNextCharacter(java.io.Reader reader, ParseOutput parseOutput)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parser

public Parser()
Method Detail

findCharacter

public static boolean findCharacter(java.io.Reader reader,
                                    ParseOutput parseOutput,
                                    char ch,
                                    boolean noStop)
                             throws java.io.IOException,
                                    ParseSyntaxException
Searches through an input reader for a particular character. Setting 'noStop' to true means the service will not stop until the character is found or until the end of the input reader. The input reader is parsed by first loading characters into the waiting buffer in 'parseOutput'. The characters are written to the output writer in 'parseOutput' if the waiting buffer is filled and 'noStop' equals true. At the time the service returns it is expected that the caller of this service will do their own handling of the current (or remaining) contents in the waiting buffer of 'parseOutput'. Note: literal string characters " and ' will enclose unparsed content with '\' being used as an escape character for " or '.

java.io.IOException
ParseSyntaxException

findCharacters

public static int findCharacters(java.io.Reader reader,
                                 ParseOutput parseOutput,
                                 char[] chs,
                                 boolean noStop)
                          throws java.io.IOException
Version of service that finds a match for one of a list of characters. Returns index of match or -1 if no match.

java.io.IOException

findCharactersEx

public static int findCharactersEx(java.io.Reader reader,
                                   ParseOutput parseOutput,
                                   char[] chs,
                                   char[] startCheck,
                                   boolean noStop)
                            throws java.io.IOException
Version of service that finds a match for one of a list of characters. Returns index of match or -1 if no match. This version terminates the search if the first characters being searched do not match the input sequence.

java.io.IOException

findHtmlTagPrefix

public static boolean findHtmlTagPrefix(java.io.Reader reader,
                                        ParseOutput parseOutput,
                                        char[] tag)
                                 throws java.io.IOException,
                                        ParseSyntaxException
Looks for a string of the form .

java.io.IOException
ParseSyntaxException

findGenericTagPrefix

public static boolean findGenericTagPrefix(java.io.Reader reader,
                                           ParseOutput parseOutput,
                                           char[] beginChars,
                                           char[] endChars,
                                           char[] tag)
                                    throws java.io.IOException,
                                           ParseSyntaxException
Looks for a general tag prefix where the first character can be any of a set of characters and the last character can be any of a set of characters.

java.io.IOException
ParseSyntaxException

findHtmlPrefixTags

public static int findHtmlPrefixTags(java.io.Reader reader,
                                     ParseOutput parseOutput,
                                     char[][] tags)
                              throws java.io.IOException,
                                     ParseSyntaxException
Looks for a match in an array of strings. Returns -1 if no match, otherwise index into array.

java.io.IOException
ParseSyntaxException

findScriptTag

public static boolean findScriptTag(java.io.Reader reader,
                                    ParseOutput parseOutput,
                                    char ch)
                             throws java.io.IOException,
                                    ParseSyntaxException
Looks for script tag. Ex: if passed in character is a '$' then script tag is of form are '<$tag$>'. Note: service outputs text read in that came before tag in the output writer in 'parseOutput' and leaves the 'tag' in the waiting buffer of 'parseOutput'.

java.io.IOException
ParseSyntaxException

removeNextCharacter

protected static int removeNextCharacter(java.io.Reader reader,
                                         ParseOutput parseOutput)
                                  throws java.io.IOException
java.io.IOException

findAnyTag

public static java.lang.String findAnyTag(java.io.Reader reader,
                                          ParseOutput parseOutput)
                                   throws java.io.IOException,
                                          ParseSyntaxException
Finds non-specified html tags.

java.io.IOException
ParseSyntaxException


(c) 1996-2005  All rights reserved.  Stellent, Inc.