cz.kebrt.html2latex
Class CSSParser

java.lang.Object
  extended by cz.kebrt.html2latex.CSSParser

public class CSSParser
extends java.lang.Object

CSS parser.


Field Summary
private  java.io.File _file
          Input file.
private  java.io.FileReader _fr
          Input file.
private  ICSSParserHandler _handler
          Handler which receives events from the parser.
private  java.io.BufferedReader _reader
          Input file.
 
Constructor Summary
CSSParser()
           
 
Method Summary
private  void destroy()
          Closes the file specified in the parse() method.
private  void doParsing()
          Parses the CSS file.
private  void init()
          Opens the file specified in the parse() method.
 void parse(java.io.File f, ICSSParserHandler handler)
          Parser the CSS file and sends events to the handler.
private  void parseStyle(java.lang.String style)
          Parses single CSS style.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_file

private java.io.File _file
Input file.


_fr

private java.io.FileReader _fr
Input file.


_reader

private java.io.BufferedReader _reader
Input file.


_handler

private ICSSParserHandler _handler
Handler which receives events from the parser.

Constructor Detail

CSSParser

public CSSParser()
Method Detail

parse

public void parse(java.io.File f,
                  ICSSParserHandler handler)
Parser the CSS file and sends events to the handler.

Parameters:
f - CSS file
handler - handler receiving events

init

private void init()
           throws ErrorException
Opens the file specified in the parse() method.

Throws:
ErrorException - when the file can't be opened

destroy

private void destroy()
              throws ErrorException
Closes the file specified in the parse() method.

Throws:
ErrorException - when the file can't be closed

doParsing

private void doParsing()
                throws java.io.IOException
Parses the CSS file. It skips CSS comments and reads each style separately. When the style is read (ie. ".bold { font-weight:bold; } ) parseStyle() method is called.

Throws:
java.io.IOException - input error occurs

parseStyle

private void parseStyle(java.lang.String style)
Parses single CSS style. Separates style name and makes a map from the properties - pairs (property name, property value).

Parameters:
style - style definition (including style name and curly brackets)