simple.ml
Class InlineLooseParser

java.lang.Object
  extended by simple.ml.InlineLooseParser

public class InlineLooseParser
extends java.lang.Object

Parses ML without recursion. Will allow tags without end tags that are not self-closing. Some may be interpreted as self-closing and have the children tags moved to the parent. To define a self closing tag add it to ParserConstants.
Other dependents:
simple.io.DoubleParsePosition
simple.util.do_str
simple.util.logging.Log
simple.util.logging.LogFactory

Created: Nov 4, 2010

Author:
Kenneth Pierce

Field Summary
protected static Log log
           
 
Constructor Summary
InlineLooseParser()
           
 
Method Summary
private static Tag createTag(java.lang.CharSequence src, DoubleParsePosition limits)
          Creates a Tag based on the raw data passed to it.
static Page parse(java.lang.CharSequence src)
          See parse(CharSequence, ParserConstants) for important notes.
static Page parse(java.lang.CharSequence src, ParserConstants pconst)
          Parses the text.
static Page parse(java.io.Reader in)
          See parse(Reader, ParserConstants) for important notes.
static Page parse(java.io.Reader in, ParserConstants pconst)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final Log log
Constructor Detail

InlineLooseParser

public InlineLooseParser()
Method Detail

parse

public static Page parse(java.lang.CharSequence src)
                  throws java.text.ParseException
See parse(CharSequence, ParserConstants) for important notes.

Parameters:
src - The text.
Returns:
A Page object that represents the source.
Throws:
java.text.ParseException

parse

public static Page parse(java.io.Reader in)
                  throws java.text.ParseException,
                         java.io.IOException
See parse(Reader, ParserConstants) for important notes.

Parameters:
in - The Reader.
Returns:
A Page object that represents the source.
Throws:
java.text.ParseException
java.io.IOException

parse

public static Page parse(java.io.Reader in,
                         ParserConstants pconst)
                  throws java.io.IOException,
                         java.text.ParseException
Throws:
java.io.IOException
java.text.ParseException

parse

public static Page parse(java.lang.CharSequence src,
                         ParserConstants pconst)
                  throws java.text.ParseException
Parses the text. NOTE: the plain text of a tag is added as a sub-tag with the name "CDATA". You can also use Tag.CDATA for the reference. This is done since the CDATA could be split by a sub-tag.(e.g. [p] text [span]text[/span] text [/p])

Parameters:
src - The text.
pconst - Options specific to this source's format.
Returns:
A Page object that represents the source.
Throws:
java.text.ParseException
See Also:
ParserConstants

createTag

private static Tag createTag(java.lang.CharSequence src,
                             DoubleParsePosition limits)
                      throws java.text.ParseException
Creates a Tag based on the raw data passed to it. Fills in attributes and the self-closing flag.

Parameters:
src - The complete source
limits - The object that represents the location of < and >
Returns:
The created tag.
Throws:
java.text.ParseException - when certain elements are missing