# Path: g_sorcery/exceptions.py
# class XMLGeneratorError(GSorceryError):
#     pass


from .exceptions import XMLGeneratorError
import xml.etree.ElementTree as ET
import xml.dom.minidom as minidom

    def generate(self, values):
        """
        Generate an XML tree filled with values from
        a given dictionary.

        Args:
            values: Data dictionary.

        Returns:
            XML tree being an istance of
            xml.etree.ElementTree.Element
        """
        root = ET.Element(self.external)
        for tag in self.schema:
            self.add_tag(root, tag, values)
        return root

    def add_tag(self, root, tag, values):
        """
        Add a tag.

        Args:
            root: A parent tag.
            tag: Tag from schema to be added.
            values: Data dictionary.
        """
        name = tag['name']
        if not name in values:
            if tag['required']:

# Path: g_sorcery/exceptions.py
# class XMLGeneratorError(GSorceryError):
#     pass


# Path: g_sorcery/metadata.py
from .exceptions import XMLGeneratorError
import xml.etree.ElementTree as ET
import xml.dom.minidom as minidom


    def generate(self, values):
        """
        Generate an XML tree filled with values from
        a given dictionary.

        Args:
            values: Data dictionary.

        Returns:
            XML tree being an istance of
            xml.etree.ElementTree.Element
        """
        root = ET.Element(self.external)
        for tag in self.schema:
            self.add_tag(root, tag, values)
        return root

    def add_tag(self, root, tag, values):
        """
        Add a tag.

        Args:
            root: A parent tag.
            tag: Tag from schema to be added.
            values: Data dictionary.
        """
        name = tag['name']
        if not name in values:
            if tag['required']:

                raise XMLGeneratorError('Required tag not found: ' + name)