All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.w3c.css.parser.CssFouffa

java.lang.Object
   |
   +----org.w3c.css.parser.analyzer.CssParser
           |
           +----org.w3c.css.parser.CssFouffa

public final class CssFouffa
extends CssParser
This class is a front end of the CSS1 parser.

Example:
CssFouffa parser = new CssFouffa(new URL("http://www.w3.org/drafts.css"));
CssValidatorListener myListener = new MyParserListener();

parser.addListener(myListener);
parser.parseStyle();


Constructor Index

 o CssFouffa(InputStream, URL)
Create a new CssFouffa with a data input.
 o CssFouffa(InputStream, URL, int)
Create a new CssFouffa with a data input and a begin line number.
 o CssFouffa(URL)
Create a new CssFouffa.

Method Index

 o addListener(CssValidatorListener)
Adds a listener to the parser.
 o getOrigin()
Returns the attribute origin
 o getProperty(String)
Return the class name for a property
 o handleAtRule(String, String)
Call by the at-rule statement.
 o handleDeclaration(String, CssExpression, boolean)
Assign an expression to a property.
 o handleImport(URL, String, AtRuleMedia)
Call by the import statement.
 o handleRule(CssSelectors, Vector)
Adds a vector of properties to a selector.
 o inAuralMode()
Get the parse state.
 o loadConfig(Properties)
Load the parser properties configuration.
 o parseDeclarations(CssSelectors)
Parse only a list of declarations.
 o parseStyle()
Parse the style sheet.
 o ReInit(InputStream, URL)
Reinitializes a new CssFouffa with a data input.
 o ReInit(InputStream, URL, int)
Reinitializes a new CssFouffa with a data input and a begin line number.
 o ReInit(URL)
Reinitializes a new CssFouffa.
 o removeListener(CssValidatorListener)
Removes a listener from the parser
 o setAuralMode()
If you want to parse aural values and properties, invoke this method. Deprecated.
 o setOrigin(int)
Set the attribute origin
 o setStyle(Class)
Set the style
 o unsetAuralMode()
If you don't want to parse aural values and properties, invoke this method. Deprecated.

Constructors

 o CssFouffa
 public CssFouffa(InputStream input,
                  URL file,
                  int beginLine) throws IOException
Create a new CssFouffa with a data input and a begin line number.

Parameters:
input - data input
file - The source file (use for errors, warnings and import)
beginLine - The begin line number in the file. (used for HTML for example)
Throws: IOException
if an I/O error occurs.
 o CssFouffa
 public CssFouffa(InputStream input,
                  URL file) throws IOException
Create a new CssFouffa with a data input.

Parameters:
input - data input
file - The source file (use for errors, warnings and import)
Throws: IOException
if an I/O error occurs.
 o CssFouffa
 public CssFouffa(URL file) throws IOException
Create a new CssFouffa.

Parameters:
file - The source file (use for data input, errors, warnings and import)
Throws: IOException
if an I/O error occurs.

Methods

 o ReInit
 public void ReInit(InputStream input,
                    URL file,
                    int beginLine) throws IOException
Reinitializes a new CssFouffa with a data input and a begin line number.

Parameters:
input - data input
file - The source file (use for errors, warnings and import)
beginLine - The begin line number in the file. (used for HTML for example)
Throws: IOException
if an I/O error occurs.
 o ReInit
 public void ReInit(InputStream input,
                    URL file) throws IOException
Reinitializes a new CssFouffa with a data input.

Parameters:
input - data input
file - The source file (use for errors, warnings and import)
Throws: IOException
if an I/O error occurs.
 o ReInit
 public void ReInit(URL file) throws IOException
Reinitializes a new CssFouffa.

Parameters:
file - The source file (use for data input, errors, warnings and import)
Throws: IOException
if an I/O error occurs.
 o setOrigin
 public final void setOrigin(int origin)
Set the attribute origin

Parameters:
origin - the new value for the attribute
 o getOrigin
 public final int getOrigin()
Returns the attribute origin

Returns:
the value of the attribute
 o addListener
 public final void addListener(CssValidatorListener listener)
Adds a listener to the parser.

Parameters:
listener - The listener
See Also:
CssValidatorListener
 o removeListener
 public final void removeListener(CssValidatorListener listener)
Removes a listener from the parser

Parameters:
listener - The listener
See Also:
CssValidatorListener
 o parseStyle
 public void parseStyle()
Parse the style sheet. This is the main function of this parser.

Example:
CssFouffa parser = new CssFouffa(new URL("http://www.w3.org/drafts.css"));
CssValidatorListener myListener = new MyParserListener();

parser.addListener(myListener);
parser.parseStyle();

See Also:
addListener
 o handleImport
 public void handleImport(URL url,
                          String file,
                          AtRuleMedia media)
Call by the import statement.

Parameters:
url - The style sheet where this import statement appears.
file - the file name in the import statement
Overrides:
handleImport in class CssParser
 o handleAtRule
 public void handleAtRule(String ident,
                          String string)
Call by the at-rule statement.

Parameters:
ident - The ident for this at-rule (for example: 'font-face')
string - The string representation of this at-rule
Overrides:
handleAtRule in class CssParser
 o handleDeclaration
 public CssProperty handleDeclaration(String property,
                                      CssExpression expression,
                                      boolean important) throws InvalidParamException
Assign an expression to a property. This function create a new property with property and assign to it the expression with the importance.

Parameters:
property - the name of the property
expression - The expression representation of expression
important - true if expression id important
InvalidParamException - An error appears during the property creation.
Returns:
a CssProperty
Overrides:
handleDeclaration in class CssParser
 o parseDeclarations
 public void parseDeclarations(CssSelectors context)
Parse only a list of declarations. This is useful to parse the STYLE attribute in a HTML document.

Example:
CssFouffa parser = new CssFouffa(new URL("http://www.w3.org/drafts.css"));
CssValidatorListener myListener = new MyParserListener();
CssSelector selector = new CssSelector(); selector.setElement("H1");
parser.addListener(myListener);
parser.parseDeclarations(selector);

Parameters:
context - The current context
See Also:
addListener, setElement
 o handleRule
 public void handleRule(CssSelectors selector,
                        Vector declarations)
Adds a vector of properties to a selector.

Parameters:
selector - the selector
declarations - Properties to associate with contexts
Overrides:
handleRule in class CssParser
 o getProperty
 public static String getProperty(String property)
Return the class name for a property

Parameters:
property - the property name ('font-size' for example)
Returns:
the class name ('org.w3c.css.properties.CssFontSize' for example)
 o setStyle
 public static void setStyle(Class style)
Set the style

 o setAuralMode
 public static void setAuralMode()
Note: setAuralMode() is deprecated.

If you want to parse aural values and properties, invoke this method. Don't use this method ! Please invoke this class like this :
CssFouffa.loadConfig(YourConfigFile);
See also org.w3c.css.parser/Config.properties

See Also:
loadConfig
 o unsetAuralMode
 public static void unsetAuralMode()
Note: unsetAuralMode() is deprecated.

If you don't want to parse aural values and properties, invoke this method. The parse, by default, doesn't parse aural values and properties. Don't use this method ! Please invoke this class like this :
CssFouffa.loadConfig(YourConfigFile);
See also org.w3c.css.parser/Config.properties

See Also:
loadConfig
 o inAuralMode
 public static boolean inAuralMode()
Get the parse state.

Returns:
true if the parse can take aural values and properties in input.
 o loadConfig
 public static void loadConfig(Properties config)
Load the parser properties configuration.

By default, the parser is configure for cascading style sheet 1.

    You have three parser properties :
  1. style: the class name of your CssStyle.
  2. properties: the file name where the parser can find all CSS properties names.
  3. extended-parser: true if you want to parse cascading style sheet 2. (only aural is implemented for the moment)


All Packages  Class Hierarchy  This Package  Previous  Next  Index