Package cssutils :: Module parse' :: Class CSSParser |
[hide private]
[frames] | no frames]

# Class CSSParser

source code

    object --+
             |
            CSSParser

parses a CSS StyleSheet string or file and returns a DOM Level 2 CSS StyleSheet object

Instance Methods | [hide private]
__init__(self, log=None, loglevel=None, raiseExceptions=False) logging object | source code
parseString(self, cssText, href=None, media=None) parse a CSSStyleSheet string returns the parsed CSS as a CSSStyleSheet object | source code
parse(self, filename, encoding=None, href=None, media=None) parse a CSSStyleSheet file returns the parsed CSS as a CSSStyleSheet object | source code
Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__str__`

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, log=None, loglevel=None, raiseExceptions=False) (Constructor) | source code
log logging object loglevel logging loglevel raiseExceptions if log should log (default) or raise Overrides: object.__init__

### parseString(self, cssText, href=None, media=None) | source code
parse a CSSStyleSheet string returns the parsed CSS as a CSSStyleSheet object cssText CSS string to parse href The href attribute to assign to the generated stylesheet media The media attribute to assign to the generated stylesheet (may be a MediaList, list or a string)

### parse(self, filename, encoding=None, href=None, media=None) | source code
parse a CSSStyleSheet file returns the parsed CSS as a CSSStyleSheet object filename name of the CSS file to parse encoding of the CSS file href The href attribute to assign to the generated stylesheet media The media attribute to assign to the generated stylesheet (may be a MediaList or a string) TODO: parse encoding from CSS file? (@charset if given) When a style sheet resides in a separate file, user agents must observe the following priorities when determining a style sheet's character encoding (from highest priority to lowest): An HTTP "charset" parameter in a "Content-Type" field (or similar parameters in other protocols) BOM and/or @charset (see below) <link charset=""> or other metadata from the linking mechanism (if any) charset of referring style sheet or document (if any) Assume UTF-8