All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface org.w3c.css.css.CssParser

public interface CssParser
This class describes how to implements your cascading style sheet parser. You must implements this interfaces if you want to have a backward compatibilitie with other CSS parser.

Typically, it is used like this :

YourParser parser = new YourParser();
parser.parseURL(yourURLDocument, StyleSheetOrigin.USER);
StyleSheet style = parser.getStyleSheet();
// here, i want an HTML document to output
StyleSheetGenerator.setDocumentBase("html.properties");
StyleSheetGenerator generator = new StyleSheetGenerator("foo", style, "foo.css", 2);
generator.print(new PrintStream(System.out));

See Also:
StyleSheetParser

Method Index

 o getStyleSheet()
Get the style sheet after a parse.
 o parseStyleAttribute(InputStream, String, URL, int)
Parser a STYLE attribute.
 o parseStyleAttribute(String, String, URL, int)
Parser a STYLE attribute. Deprecated.
 o parseStyleElement(InputStream, URL, int)
Parse a STYLE element.
 o parseStyleElement(String, URL, int)
Parse a STYLE element. Deprecated.
 o parseURL(URL, int)
Parse an URL
 o reInit()
Reinitialize this parser

Methods

 o reInit
 public abstract void reInit()
Reinitialize this parser

 o getStyleSheet
 public abstract StyleSheet getStyleSheet()
Get the style sheet after a parse.

Returns:
The resulted style sheet
 o parseURL
 public abstract void parseURL(URL url,
                               int origin)
Parse an URL

Parameters:
url - the URL to parse
origin - the origin of the style sheet
See Also:
StyleSheetOrigin
 o parseStyleElement
 public abstract void parseStyleElement(String input,
                                        URL url,
                                        int lineno)
Note: parseStyleElement() is deprecated. Replaced by parseStyleElement

Parse a STYLE element. The real difference between this method and the precedent is that this method can take a string. The URL is used to resolve import statement and URL statement in the style sheet.

For a backward compatibility, parseStyleElement and parseStyleAttribute use a string for the input.

Parameters:
input - the input string.
url - the URL where the input stream comes from.
lineno - The number line in the source document. It is used for error message
See Also:
parseStyleElement
 o parseStyleElement
 public abstract void parseStyleElement(InputStream input,
                                        URL url,
                                        int lineno)
Parse a STYLE element. The real difference between this method and the precedent is that this method can take an InputStream. The URL is used to resolve import statement and URL statement in the style sheet.

Parameters:
input - the input stream.
url - the URL where the input stream comes from.
lineno - The number line in the source document. It is used for error message
 o parseStyleAttribute
 public abstract void parseStyleAttribute(String input,
                                          String id,
                                          URL url,
                                          int lineno)
Note: parseStyleAttribute() is deprecated. Replaced by parseStyleAttribute

Parser a STYLE attribute. Here, you must generate your own uniq id for the context. After, you can reference this style attribute by the id.

Be careful, the id must be uniq !

For a backward compatibility, parseStyleElement and parseStyleAttribute use a string for the input.

Parameters:
input - the input string.
id - your uniq id to reference this style attribute.
url - the URL where the input stream comes from.
lineno - The number line in the source document. It is used for error message.
See Also:
parseStyleAttribute
 o parseStyleAttribute
 public abstract void parseStyleAttribute(InputStream input,
                                          String id,
                                          URL url,
                                          int lineno)
Parser a STYLE attribute. Here, you must generate your own uniq id for the context. After, you can reference this style attribute by the id.

Be careful, the id must be uniq !

Parameters:
input - the input stream.
id - your uniq id to reference this style attribute.
url - the URL where the input stream comes from.
lineno - The number line in the source document. It is used for error message.

All Packages  Class Hierarchy  This Package  Previous  Next  Index