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

Usage:

parser = CSSParser()
stylesheet = p.parse('test1.css', 'ascii')

print stylesheet.cssText
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 simple log (default) or raise errors
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, defaults to 'css' codec encoding
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)