Class defining a namespace.
More...
|
def | __init__ (self, make_identifier=True, substitute='_', kwargs) |
| Method to initialize a CMLNamespace object. More...
|
|
def | add_attribute (self, key, value, make_identifier=True, substitute='_') |
| Add attribute to the namespace. More...
|
|
def | to_string (self, level=0, indent=1) |
| Create a string representing the namespace. More...
|
|
def | __str__ (self) |
| Return a string representing the namespace. More...
|
|
Class defining a namespace.
◆ __init__()
def carputils.cml.cmltree.CMLNamespace.__init__ |
( |
|
self, |
|
|
|
make_identifier = True , |
|
|
|
substitute = '_' , |
|
|
|
kwargs |
|
) |
| |
Method to initialize a CMLNamespace object.
- Parameters
-
make_identifier | If True, the keys of kwargs are converted to identifiers |
substitute | A valid identifier string used to replace invalid characters in the key strings |
kwargs | Key-value pairs where the keys are added as attributes to the namespace with the corresponding values assigned to them |
◆ __str__()
def carputils.cml.cmltree.CMLNamespace.__str__ |
( |
|
self | ) |
|
Return a string representing the namespace.
- Returns
- A string representing the namespace
◆ add_attribute()
def carputils.cml.cmltree.CMLNamespace.add_attribute |
( |
|
self, |
|
|
|
key, |
|
|
|
value, |
|
|
|
make_identifier = True , |
|
|
|
substitute = '_' |
|
) |
| |
Add attribute to the namespace.
- Parameters
-
key | Attribute name |
value | Attribute value |
make_identifier | If True, the attribute name key is converted to an identifier |
substitute | A valid identifier string used to replace invalid characters in the key strings |
- Exceptions
-
AttributeError | If key is not a valid identifier string and make_identifier is False. |
◆ to_string()
def carputils.cml.cmltree.CMLNamespace.to_string |
( |
|
self, |
|
|
|
level = 0 , |
|
|
|
indent = 1 |
|
) |
| |
Create a string representing the namespace.
- Parameters
-
level | indention level |
indent | number of spaces per level |
- Returns
- A string representing the namespace
The documentation for this class was generated from the following file: