# Path: lems/base/base.py
# class LEMSBase(object):
#     """
#     Base object for PyLEMS.
#     """
# 
#     def copy(self):
#         return copy.deepcopy(self)
# 
#     def toxml(self):
#         return ""
# 
# Path: lems/base/errors.py
# class ParseError(LEMSError):
#     """
#     Exception class to signal errors found during parsing.
#     """
# 
#     pass
# 
# Path: lems/base/util.py
# def make_id():
#     global id_counter
#     id_counter = id_counter + 1
#     return "__id_{0}__".format(id_counter)


import xml.etree.ElementTree as xe
from lems.base.base import LEMSBase
from lems.base.errors import ParseError
from lems.model.fundamental import *
from lems.model.component import *
from lems.model.dynamics import *
from lems.model.structure import *
from lems.model.simulation import *
from lems.base.util import make_id
        component = Component(id_, type_)

        if self.current_component:
            component.set_parent_id(self.current_component.id)
            self.current_component.add_child(component)

        else:
            self.model.add_component(component)

        for key in node.attrib:
            if key.lower() not in ["id", "type"]:
                component.set_parameter(key, node.attrib[key])

        old_component = self.current_component
        self.current_component = component
        self.process_nested_tags(node, "component")
        self.current_component = old_component

    def parse_component(self, node):
        """
        Parses <Component>

        :param node: Node containing the <Component> element
        :type node: xml.etree.Element
        """

        if "id" in node.lattrib:
            id_ = node.lattrib["id"]
        else:
            # self.raise_error('Component must have an id')

# Path: lems/base/base.py
# class LEMSBase(object):
#     """
#     Base object for PyLEMS.
#     """
# 
#     def copy(self):
#         return copy.deepcopy(self)
# 
#     def toxml(self):
#         return ""
# 
# Path: lems/base/errors.py
# class ParseError(LEMSError):
#     """
#     Exception class to signal errors found during parsing.
#     """
# 
#     pass
# 
# Path: lems/base/util.py
# def make_id():
#     global id_counter
#     id_counter = id_counter + 1
#     return "__id_{0}__".format(id_counter)


# Path: lems/parser/LEMS.py
import xml.etree.ElementTree as xe
from lems.base.base import LEMSBase
from lems.base.errors import ParseError
from lems.model.fundamental import *
from lems.model.component import *
from lems.model.dynamics import *
from lems.model.structure import *
from lems.model.simulation import *
from lems.base.util import make_id

        component = Component(id_, type_)

        if self.current_component:
            component.set_parent_id(self.current_component.id)
            self.current_component.add_child(component)

        else:
            self.model.add_component(component)

        for key in node.attrib:
            if key.lower() not in ["id", "type"]:
                component.set_parameter(key, node.attrib[key])

        old_component = self.current_component
        self.current_component = component
        self.process_nested_tags(node, "component")
        self.current_component = old_component

    def parse_component(self, node):
        """
        Parses <Component>

        :param node: Node containing the <Component> element
        :type node: xml.etree.Element
        """

        if "id" in node.lattrib:
            id_ = node.lattrib["id"]
        else:
            # self.raise_error('Component must have an id')

            id_ = make_id()