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();
-
CssFouffa(InputStream, URL)
- Create a new CssFouffa with a data input.
-
CssFouffa(InputStream, URL, int)
- Create a new CssFouffa with a data input and a begin line number.
-
CssFouffa(URL)
- Create a new CssFouffa.
-
addListener(CssValidatorListener)
- Adds a listener to the parser.
-
getOrigin()
- Returns the attribute origin
-
getProperty(String)
- Return the class name for a property
-
handleAtRule(String, String)
- Call by the at-rule statement.
-
handleDeclaration(String, CssExpression, boolean)
- Assign an expression to a property.
-
handleImport(URL, String, AtRuleMedia)
- Call by the import statement.
-
handleRule(CssSelectors, Vector)
- Adds a vector of properties to a selector.
-
inAuralMode()
- Get the parse state.
-
loadConfig(Properties)
- Load the parser properties configuration.
-
parseDeclarations(CssSelectors)
- Parse only a list of declarations.
-
parseStyle()
- Parse the style sheet.
-
ReInit(InputStream, URL)
- Reinitializes a new CssFouffa with a data input.
-
ReInit(InputStream, URL, int)
- Reinitializes a new CssFouffa with a data input and a begin line number.
-
ReInit(URL)
- Reinitializes a new CssFouffa.
-
removeListener(CssValidatorListener)
- Removes a listener from the parser
-
setAuralMode()
- If you want to parse aural values and properties, invoke this method.
Deprecated.
-
setOrigin(int)
- Set the attribute origin
-
setStyle(Class)
- Set the style
-
unsetAuralMode()
- If you don't want to parse aural values and properties, invoke this method.
Deprecated.
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.
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.
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.
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.
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.
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.
setOrigin
public final void setOrigin(int origin)
- Set the attribute origin
- Parameters:
- origin - the new value for the attribute
getOrigin
public final int getOrigin()
- Returns the attribute origin
- Returns:
- the value of the attribute
addListener
public final void addListener(CssValidatorListener listener)
- Adds a listener to the parser.
- Parameters:
- listener - The listener
- See Also:
- CssValidatorListener
removeListener
public final void removeListener(CssValidatorListener listener)
- Removes a listener from the parser
- Parameters:
- listener - The listener
- See Also:
- CssValidatorListener
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
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
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
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
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
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
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)
setStyle
public static void setStyle(Class style)
- Set the style
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
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
inAuralMode
public static boolean inAuralMode()
- Get the parse state.
- Returns:
-
true if the parse can take aural values and properties
in input.
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 :
- style: the class name of your CssStyle.
- properties: the file name where the parser can find all CSS properties
names.
- 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