# Path: clam/common/util.py
# def xmlescape(s):
#     begin = -1
#     s2 = ""
#     for i,c in enumerate(s):
#         if c == '&':
#             begin = i
#         elif c == ';':
#             if begin > -1:
#                 s2 += s[begin:i+1]
#                 begin = -1
#             else:
#                 s2 += c
#         elif c == ' ':
#             if begin != -1:
#                 s2 += "&amp;" + s[begin+1:i+1]
#                 begin = -1
#             else:
#                 s2 += c
#         elif c == '<':
#             s2 += "&lt;"
#         elif c == '>':
#             s2 += "&gt;"
#         elif c == '"':
#             s2 += "&quot;"
#         elif begin == -1:
#             s2 += c
#     if begin != -1:
#         s2 += "&amp;" + s[begin+1:]
#     s = s2
#     return s


import sys
                import pdb; pdb.set_trace()
from lxml import etree as ElementTree
from io import StringIO #pylint: disable=wrong-import-order
from clam.common.util import xmlescape
        elif self.paramflag:
            sep = ' '
        else:
            return str(value)
        return self.paramflag + sep + str(value)

    def xml(self, indent = ""):
        """This methods renders an XML representation of this parameter, along with
        its selected value, and feedback on validation errors"""
        xml = indent + "<" + self.__class__.__name__
        xml += ' id="'+self.id + '"'
        xml += ' name="'+xmlescape(self.name) + '"'
        xml += ' description="'+xmlescape(self.description) + '"'
        if self.paramflag:
            xml += ' flag="'+self.paramflag + '"'
        if self.multi:
            xml += ' multi="true"'
        for key, value in self.kwargs.items():
            if key != 'choices' and key != 'default' and key != 'flag' and key != 'paramflag':
                if isinstance(value, bool):
                    xml += ' ' + key + '="' + str(int(value))+ '"'
                elif isinstance(value, list):
                    xml += ' ' + key + '="'+",".join(value)+ '"'
                else:
                    xml += ' ' + key + '="'+xmlescape(value)+ '"'
        if self.error:
            xml += ' error="'+self.error + '"'
        xml += ">"
        for key, value in self.choices:
            if self.value == key or (isinstance(self.value ,list) and key in self.value):

# Path: clam/common/util.py
# def xmlescape(s):
#     begin = -1
#     s2 = ""
#     for i,c in enumerate(s):
#         if c == '&':
#             begin = i
#         elif c == ';':
#             if begin > -1:
#                 s2 += s[begin:i+1]
#                 begin = -1
#             else:
#                 s2 += c
#         elif c == ' ':
#             if begin != -1:
#                 s2 += "&amp;" + s[begin+1:i+1]
#                 begin = -1
#             else:
#                 s2 += c
#         elif c == '<':
#             s2 += "&lt;"
#         elif c == '>':
#             s2 += "&gt;"
#         elif c == '"':
#             s2 += "&quot;"
#         elif begin == -1:
#             s2 += c
#     if begin != -1:
#         s2 += "&amp;" + s[begin+1:]
#     s = s2
#     return s


# Path: clam/common/parameters.py
import sys
                import pdb; pdb.set_trace()
from lxml import etree as ElementTree
from io import StringIO #pylint: disable=wrong-import-order
from clam.common.util import xmlescape

        elif self.paramflag:
            sep = ' '
        else:
            return str(value)
        return self.paramflag + sep + str(value)

    def xml(self, indent = ""):
        """This methods renders an XML representation of this parameter, along with
        its selected value, and feedback on validation errors"""
        xml = indent + "<" + self.__class__.__name__
        xml += ' id="'+self.id + '"'
        xml += ' name="'+xmlescape(self.name) + '"'
        xml += ' description="'+xmlescape(self.description) + '"'
        if self.paramflag:
            xml += ' flag="'+self.paramflag + '"'
        if self.multi:
            xml += ' multi="true"'
        for key, value in self.kwargs.items():
            if key != 'choices' and key != 'default' and key != 'flag' and key != 'paramflag':
                if isinstance(value, bool):
                    xml += ' ' + key + '="' + str(int(value))+ '"'
                elif isinstance(value, list):
                    xml += ' ' + key + '="'+",".join(value)+ '"'
                else:
                    xml += ' ' + key + '="'+xmlescape(value)+ '"'
        if self.error:
            xml += ' error="'+self.error + '"'
        xml += ">"
        for key, value in self.choices:
            if self.value == key or (isinstance(self.value ,list) and key in self.value):

                xml += " <choice id=\""+key+"\" selected=\"1\">" + xmlescape(value) + "</choice>"