carputils
Doxygen code documentation for the python framework controlling openCARP
Public Member Functions | List of all members
carputils.cml.cmltree.CMLNamespace Class Reference

Class defining a namespace. More...

Public Member Functions

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...
 

Detailed Description

Class defining a namespace.

Constructor & Destructor Documentation

◆ __init__()

def carputils.cml.cmltree.CMLNamespace.__init__ (   self,
  make_identifier = True,
  substitute = '_',
  kwargs 
)

Method to initialize a CMLNamespace object.

Parameters
make_identifierIf True, the keys of kwargs are converted to identifiers
substituteA valid identifier string used to replace invalid characters in the key strings
kwargsKey-value pairs where the keys are added as attributes to the namespace with the corresponding values assigned to them

Member Function Documentation

◆ __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
keyAttribute name
valueAttribute value
make_identifierIf True, the attribute name key is converted to an identifier
substituteA valid identifier string used to replace invalid characters in the key strings
Exceptions
AttributeErrorIf 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
levelindention level
indentnumber of spaces per level
Returns
A string representing the namespace

The documentation for this class was generated from the following file: