Package cssutils :: Package css :: Module cssnamespacerule :: Class CSSNamespaceRule |
[hide private]
[frames] | no frames]

# Class CSSNamespaceRule

source code

    object --+
             |
     util.Base --+
                 |
        util.Base2 --+
                     |
       cssrule.CSSRule --+
                         |
                        CSSNamespaceRule

Represents an @namespace rule within a CSS style sheet.

The @namespace at-rule declares a namespace prefix and associates it with a given namespace (a string). This namespace prefix can then be used in namespace-qualified names such as those described in the Selectors Module [SELECT] or the Values and Units module [CSS3VAL].

# Properties

atkeyword (cssutils only)
  the literal keyword used
cssText: of type DOMString
  The parsable textual representation of this rule
namespaceURI: of type DOMString
  The namespace URI (a simple string!) which is bound to the given prefix. If no prefix is set (`CSSNamespaceRule.prefix==''`) the namespace defined by `namespaceURI` is set as the default namespace.
prefix: of type DOMString
  The prefix used in the stylesheet for the given `CSSNamespaceRule.nsuri`. If prefix is empty namespaceURI sets a default namespace for the stylesheet.

Inherits properties from CSSRule

# Format

namespace
  : NAMESPACE_SYM S* [namespace_prefix S*]? [STRING|URI] S* ';' S* ;
namespace_prefix
  : IDENT ;

Nested Classes | [hide private]
Inherited from `util.Base` (private): `_prods`

Instance Methods | [hide private]
__init__(self, namespaceURI=None, prefix=None, cssText=None, parentRule=None, parentStyleSheet=None, readonly=False) Do not use as positional but as keyword parameters only! | source code
_getCssText(self) returns serialized property cssText | source code
_setCssText(self, cssText) DOMException on setting | source code
_setNamespaceURI(self, namespaceURI) DOMException on setting | source code
_setPrefix(self, prefix=None) DOMException on setting | source code
__repr__(self) repr(x) | source code
__str__(self) str(x) | source code
Inherited from `cssrule.CSSRule` (private): `_setAtkeyword` Inherited from `util.Base2` (private): `_adddefaultproductions`, `_setSeq`, `_tempSeq` Inherited from `util.Base` (private): `_checkReadonly`, `_nexttoken`, `_parse`, `_splitNamespacesOff`, `_stringtokenvalue`, `_tokenize2`, `_tokensupto2`, `_tokenvalue`, `_type`, `_uritokenvalue`, `_valuestr` Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`

Static Methods | [hide private]
Inherited from `util.Base` (private): `_normalize`

Class Variables | [hide private]
Inherited from `cssrule.CSSRule`: `CHARSET_RULE`, `COMMENT`, `FONT_FACE_RULE`, `IMPORT_RULE`, `MEDIA_RULE`, `NAMESPACE_RULE`, `PAGE_RULE`, `STYLE_RULE`, `UNKNOWN_RULE` Inherited from `cssrule.CSSRule` (private): `_typestrings` Inherited from `util.Base` (private): `_SHORTHANDPROPERTIES`, `_log`

Properties | [hide private]
| type The type of this rule, as defined by a CSSRule type constant.
| cssText (DOM attribute) The parsable textual representation.
| namespaceURI URI (string!) of the defined namespace.
| prefix Prefix used for the defined namespace.
| wellformed READONLY
Inherited from `cssrule.CSSRule`: `atkeyword`, `parentRule`, `parentStyleSheet`, `typeString` Inherited from `util.Base2`: `seq` Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, namespaceURI=None, prefix=None, cssText=None, parentRule=None, parentStyleSheet=None, readonly=False) (Constructor) | source code
Do not use as positional but as keyword parameters only! If readonly allows setting of properties in constructor only format namespace:
    namespace
      : NAMESPACE_SYM S* [namespace_prefix S*]? [STRING|URI] S* ';' S*
      ;
    namespace_prefix
      : IDENT
      ;
Parameters: `namespaceURI` - The namespace URI (a simple string!) which is bound to the given prefix. If no prefix is set (`CSSNamespaceRule.prefix==''`) the namespace defined by namespaceURI is set as the default namespace `prefix` - The prefix used in the stylesheet for the given `CSSNamespaceRule.uri`. `cssText` - if no namespaceURI is given cssText must be given to set a namespaceURI as this is readonly later on `parentStyleSheet` - sheet where this rule belongs to Overrides: object.__init__

### _setCssText(self, cssText) | source code
DOMException on setting Parameters: `cssText` - initial value for this rules cssText which is parsed Raises: `HIERARCHY_REQUEST_ERR` - (CSSStylesheet) Raised if the rule cannot be inserted at this point in the style sheet. `INVALID_MODIFICATION_ERR` - (self) Raised if the specified CSS string value represents a different type of rule than the current one. `NO_MODIFICATION_ALLOWED_ERR` - (CSSRule) Raised if the rule is readonly. `SYNTAX_ERR` - (self) Raised if the specified CSS string value has a syntax error and is unparsable. Overrides: cssrule.CSSRule._setCssText

### _setNamespaceURI(self, namespaceURI) | source code
DOMException on setting Parameters: `namespaceURI` - the initial value for this rules namespaceURI Raises: `NO_MODIFICATION_ALLOWED_ERR` - (CSSRule) Raised if this rule is readonly or a namespaceURI is already set in this rule.

### _setPrefix(self, prefix=None) | source code
DOMException on setting Parameters: `prefix` - the new prefix Raises: `SYNTAX_ERR` - (TODO) Raised if the specified CSS string value has a syntax error and is unparsable. `NO_MODIFICATION_ALLOWED_ERR` - CSSRule) Raised if this rule is readonly.

### __repr__(self) (Representation operator) | source code
repr(x) Overrides: object.__repr__ (inherited documentation)

### __str__(self) (Informal representation operator) | source code
str(x) Overrides: object.__str__ (inherited documentation)

Property Details | [hide private]

### type The type of this rule, as defined by a CSSRule type constant. Overwritten in derived classes. The expectation is that binding-specific casting methods can be used to cast down from an instance of the CSSRule interface to the specific derived interface implied by the type. (Casting not for this Python implementation I guess...) Get Method: unreachable(self)

### cssText (DOM attribute) The parsable textual representation. Get Method: _getCssText(self) - returns serialized property cssText Set Method: _setCssText(self, cssText) - DOMException on setting

### namespaceURI URI (string!) of the defined namespace. Get Method: unreachable(self) Set Method: _setNamespaceURI(self, namespaceURI) - DOMException on setting

### prefix Prefix used for the defined namespace. Get Method: unreachable(self) Set Method: _setPrefix(self, prefix=None) - DOMException on setting

### wellformed READONLY Get Method: unreachable(self)