org.apache.cocoon.slop.parsing
Class SimpleSlopParser

java.lang.Object
  extended by org.apache.cocoon.slop.parsing.SimpleSlopParser
All Implemented Interfaces:
SlopConstants, SlopParser

public class SimpleSlopParser
extends Object
implements SlopParser, SlopConstants

Simplistic SLOP parser, recognizes the following constructs: Field: a line starting with letters and : is considered a field Empty lines are detected. Other lines are output as line elements This is sufficient for basic parsing of RFC 822 headers, but a configurable rfc822 mode would be good to differentiate between the header and body of the email message and parse them with different rules.

Version:
$Id: SimpleSlopParser.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Bertrand Delacretaz

Field Summary
 
Fields inherited from interface org.apache.cocoon.slop.interfaces.SlopConstants
SLOP_ATTR_LINENUMBER, SLOP_EMPTY_LINE_ELEMENT, SLOP_LINE_ELEMENT, SLOP_NAMESPACE_URI, SLOP_ROOT_ELEMENT
 
Constructor Summary
SimpleSlopParser()
           
 
Method Summary
 void endDocument()
          must be called once all calls to processLine() are done
protected  org.apache.cocoon.slop.parsing.SimpleSlopParser.ParsedLine parseLine(String line)
          parse a line, extract element name and contents
 void processLine(String line)
          call this to process input lines, does the actual parsing
 void setPreserveWhitespace(boolean b)
          optionally preserve whitespace in input
 void setValidTagnameChars(String str)
          set the list of valid chars for tag names (in addition to letters)
 void startDocument(ContentHandler destination)
          must be called before any call to processLine()
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleSlopParser

public SimpleSlopParser()
Method Detail

setValidTagnameChars

public void setValidTagnameChars(String str)
set the list of valid chars for tag names (in addition to letters)


setPreserveWhitespace

public void setPreserveWhitespace(boolean b)
optionally preserve whitespace in input


startDocument

public void startDocument(ContentHandler destination)
                   throws SAXException,
                          ProcessingException
must be called before any call to processLine()

Specified by:
startDocument in interface SlopParser
Throws:
SAXException
ProcessingException

endDocument

public void endDocument()
                 throws SAXException,
                        ProcessingException
must be called once all calls to processLine() are done

Specified by:
endDocument in interface SlopParser
Throws:
SAXException
ProcessingException

processLine

public void processLine(String line)
                 throws SAXException,
                        ProcessingException
call this to process input lines, does the actual parsing

Specified by:
processLine in interface SlopParser
Throws:
SAXException
ProcessingException

parseLine

protected org.apache.cocoon.slop.parsing.SimpleSlopParser.ParsedLine parseLine(String line)
parse a line, extract element name and contents



Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.