fi.iki.hsivonen.xml
Class SimpleWikiParser

java.lang.Object
  extended by fi.iki.hsivonen.xml.SimpleWikiParser

public class SimpleWikiParser
extends Object

TODO Warning: Not tested after refactoring. Need to check for permissible characters.

Version:
$Id: SimpleWikiParser.java,v 1.2 2006/11/18 00:05:24 hsivonen Exp $
Author:
taavi, hsivonen

Field Summary
private  ContentHandler contentHandler
           
private  ErrorHandler errorHandler
           
private  String source
           
private  String title
           
 
Constructor Summary
SimpleWikiParser()
           
 
Method Summary
private  void characters(char[] a, int b, int c)
           
private  void endDocument()
           
private  void endElement(String a, String b, String c)
           
private  void foo()
          Takes a string and builds DOM Document of it by scanning the string and emitting SAX Events for DOMConsumer.
 ContentHandler getContentHandler()
           
 ErrorHandler getErrorHandler()
           
private  boolean isWhiteSpace(char c)
          Checks if the given char is whitespace.
 void parse()
           
 void setContentHandler(ContentHandler arg0)
           
 void setErrorHandler(ErrorHandler arg0)
           
private  void startDocument()
           
private  void startElement(String a, String b, String c, Attributes attrs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contentHandler

private ContentHandler contentHandler

errorHandler

private ErrorHandler errorHandler

source

private String source

title

private String title
Constructor Detail

SimpleWikiParser

public SimpleWikiParser()
Method Detail

setContentHandler

public void setContentHandler(ContentHandler arg0)
See Also:
XMLReader.setContentHandler(org.xml.sax.ContentHandler)

getContentHandler

public ContentHandler getContentHandler()
See Also:
XMLReader.getContentHandler()

setErrorHandler

public void setErrorHandler(ErrorHandler arg0)
See Also:
XMLReader.setErrorHandler(org.xml.sax.ErrorHandler)

getErrorHandler

public ErrorHandler getErrorHandler()
See Also:
XMLReader.getErrorHandler()

parse

public void parse()
           throws IOException,
                  SAXException
Throws:
IOException
SAXException

foo

private void foo()
          throws SAXException,
                 IOException
Takes a string and builds DOM Document of it by scanning the string and emitting SAX Events for DOMConsumer. The root element for the document will be . Multiple linefeeds (1 linefeed here means \n, \r or \r\n) invoke

. Non-empty body always contains at least one p element. [linkTarget link title] is turned into link title . Link title [[ can be used to insert a single '['.

Parameters:
source - the string of which the document is built
Throws:
SAXException
IOException - if there are problems when loading the DOM class

isWhiteSpace

private boolean isWhiteSpace(char c)
Checks if the given char is whitespace. For now whitespace means ' ' or '\t'.

Parameters:
c -
Returns:
true if give char is whitespace

characters

private void characters(char[] a,
                        int b,
                        int c)
                 throws SAXException
Throws:
SAXException

startElement

private void startElement(String a,
                          String b,
                          String c,
                          Attributes attrs)
                   throws SAXException
Throws:
SAXException

endElement

private void endElement(String a,
                        String b,
                        String c)
                 throws SAXException
Throws:
SAXException

startDocument

private void startDocument()
                    throws SAXException
Throws:
SAXException

endDocument

private void endDocument()
                  throws SAXException
Throws:
SAXException