FoodCandy!

Parser Class Reference

Parse iCalendar rfc2445 streams and convert to another format based on the emitter used. More...

List of all members.


Public Member Functions

 Parser (TextReader reader, IEmitter _emitter)
 Create a new iCalendar parser.
void Parse ()
 Give public access to the parse stack.

Main entry point for starting the Parser.

void Parse (bool emitHandT)
 Alternate entry point for starting the parser.

Protected Member Functions

void reportError (Scanner s, string msg)
void reportFatalError (Scanner s, string msg)
virtual bool parseID ()
 Parse the first field (ID) of the line. Returns a boolean on weather or not the method sucesfully recognized an ID. If not, the method insures that the scanner will start at the beginning of a new line.
virtual bool parseAttributes (Scanner scan)
 Parse the list of attributes - separated by ';'s. Attributes always are in the form 'id=value' and indicate key/value pairs in the iCalendar attribute format.
virtual bool parseValue ()
 Parse the value. The value is the last data item on a iCalendar input line.

Properties

ArrayList Errors
string ErrorString
bool HasErrors

Detailed Description

Parse iCalendar rfc2445 streams and convert to another format based on the emitter used.

This class is the main entry point for the ICalParser library. A parser is created with a TextReader that contains the iCalendar stream to be parsed, and an IEmitter, which is used to transform the iCalendar into another format.

Each iCalendar format file is in the form:

ID[[;attr1;attr2;attr3;...;attrn]:value]

where ID is the main keyword identifying the iCalendar entry, followed optionally by a set of attributes and a single value. The parser works by identifying the specific IDs, attributes and values, categorizing them based on similar 'behaviour' (as defined in the

Token</code>
        class) and passing on recognized symbols to the emitter for further processing.  
        
        The error recovery policy of the parser is pretty simple.  When an error is detected, it is recorded,
        and the rest of the (possibly folded) line is read, and parsing continues.  
        
        
        <example>
        The following snippet will read the contents of the file 'myCalendar.ics', which the
        parser will expect to contain iCalendar statements, and will write the RdfICalendar
        equivalent to standard output.
        <code>
            RDFEmitter emitter = new RDFEmitter( );
            StreamReader reader = new StreamReader( "myCalendar.ics" );
            Parser parser = new Parser( reader, emitter );
            parser.Parse( );
            Console.WriteLine( emitter.Rdf );


Constructor & Destructor Documentation

Parser TextReader  reader,
IEmitter  _emitter
 

Create a new iCalendar parser.

Parameters:
reader The reader that contains the stream of text iCalendar
_emitter The emitter that will transform the iCalendar elements

Member Function Documentation

void Parse bool  emitHandT  ) 
 

Alternate entry point for starting the parser.

Parameters:
emitHandT Indicates if the emitter should be told to emit headers and trailers before and after emitting the iCalendar body

virtual bool parseAttributes Scanner  scan  )  [protected, virtual]
 

Parse the list of attributes - separated by ';'s. Attributes always are in the form 'id=value' and indicate key/value pairs in the iCalendar attribute format.

Returns:

virtual bool parseID  )  [protected, virtual]
 

Parse the first field (ID) of the line. Returns a boolean on weather or not the method sucesfully recognized an ID. If not, the method insures that the scanner will start at the beginning of a new line.

Returns:

virtual bool parseValue  )  [protected, virtual]
 

Parse the value. The value is the last data item on a iCalendar input line.

Returns:

The documentation for this class was generated from the following file:
  • Parser.cs
© FoodCandy, 2006-2007, All Rights Reserved | FoodCandy | Sun Oct 7 10:48:52 2007 | Doxygen 1.4.6-NO