def __init__(self, xml_file=None):
    '\n        Given a well formed XML file (xml_file), read it and turn it into\n        a big string.\n        '
    self.__root = None
    self.__name = ''
    self.__namespace = None
    self.__include_header_files = []
    self.__includes = []
    self.__include_enum_files = []
    self.__include_array_files = []
    self.__comment = ''
    self.__members = []
    self.__type_id = None
    if (os.path.isfile(xml_file) == False):
        stri = ('ERROR: Could not find specified XML file %s.' % xml_file)
        raise OSError(stri)
    fd = open(xml_file)
    xml_file = os.path.basename(xml_file)
    self.__xml_filename = xml_file
    self.__config = ConfigManager.ConfigManager.getInstance()
    xml_parser = etree.XMLParser(remove_comments=True)
    element_tree = etree.parse(fd, parser=xml_parser)
    rng_file = self.__config.get('schema', element_tree.getroot().tag.lower()).lstrip('/')
    try:
        rng_file = locate_build_root(rng_file)
    except (BuildRootMissingException, BuildRootCollisionException) as bre:
        stri = 'ERROR: Could not find specified RNG file {}. {}'.format(rng_file, str(bre))
        raise OSError(stri)
    file_handler = open(rng_file)
    relax_parsed = etree.parse(file_handler)
    file_handler.close()
    relax_compiled = etree.RelaxNG(relax_parsed)
    if (not relax_compiled.validate(element_tree)):
        msg = 'XML file {} is not valid according to schema {}.'.format(xml_file, rng_file)
        raise FprimeXmlException(msg)
    serializable = element_tree.getroot()
    if (serializable.tag != 'serializable'):
        PRINT.info(('%s is not a serializable definition file' % xml_file))
        sys.exit((- 1))
    print(('Parsing Serializable %s' % serializable.attrib['name']))
    self.__name = serializable.attrib['name']
    if ('namespace' in serializable.attrib):
        self.__namespace = serializable.attrib['namespace']
    else:
        self.__namespace = None
    if ('typeid' in serializable.attrib):
        self.__type_id = serializable.attrib['typeid']
    else:
        self.__type_id = None
    for serializable_tag in serializable:
        if (serializable_tag.tag == 'comment'):
            self.__comment = serializable_tag.text.strip()
        elif (serializable_tag.tag == 'include_header'):
            self.__include_header_files.append(serializable_tag.text)
        elif (serializable_tag.tag == 'import_serializable_type'):
            self.__includes.append(serializable_tag.text)
        elif (serializable_tag.tag == 'import_enum_type'):
            self.__include_enum_files.append(serializable_tag.text)
        elif (serializable_tag.tag == 'import_array_type'):
            self.__include_array_files.append(serializable_tag.text)
        elif (serializable_tag.tag == 'members'):
            for member in serializable_tag:
                if (member.tag != 'member'):
                    PRINT.info(('%s: Invalid tag %s in serializable member definition' % (xml_file, member.tag)))
                    sys.exit((- 1))
                n = member.attrib['name']
                t = member.attrib['type']
                if ('size' in list(member.attrib.keys())):
                    if (t == 'ENUM'):
                        PRINT.info(('%s: Member %s: arrays of enums not supported yet!' % (xml_file, n)))
                        sys.exit((- 1))
                    s = member.attrib['size']
                    if (not s.isdigit()):
                        PRINT.info('{}: Member {}: size must be a number'.format(xml_file, n))
                        sys.exit((- 1))
                else:
                    s = None
                if ('format' in list(member.attrib.keys())):
                    f = member.attrib['format']
                elif (t in list(format_dictionary.keys())):
                    f = format_dictionary[t]
                else:
                    f = '%s'
                if (t == 'string'):
                    if (s is None):
                        PRINT.info(('%s: member %s string must specify size tag' % (xml_file, member.tag)))
                        sys.exit((- 1))
                if ('comment' in list(member.attrib.keys())):
                    c = member.attrib['comment']
                else:
                    c = None
                for member_tag in member:
                    if ((member_tag.tag == 'enum') and (t == 'ENUM')):
                        en = member_tag.attrib['name']
                        enum_members = []
                        for mem in member_tag:
                            mn = mem.attrib['name']
                            if ('value' in list(mem.attrib.keys())):
                                v = mem.attrib['value']
                            else:
                                v = None
                            if ('comment' in list(mem.attrib.keys())):
                                mc = mem.attrib['comment'].strip()
                            else:
                                mc = None
                            enum_members.append((mn, v, mc))
                        t = ((t, en), enum_members)
                    else:
                        PRINT.info(('%s: Invalid member tag %s in serializable member %s' % (xml_file, member_tag.tag, n)))
                        sys.exit((- 1))
                self.__members.append((n, t, s, f, c))
    if (not ('typeid' in serializable.attrib)):
        s = etree.tostring(element_tree.getroot())
        h = hashlib.sha256(s)
        n = h.hexdigest()
        self.__type_id = ('0x' + n.upper()[(- 8):])
Given a well formed XML file (xml_file), read it and turn it into
a big string.
def __init__(self, xml_file=None):
    '\n        Given a well formed XML file (xml_file), read it and turn it into\n        a big string.\n        '
    self.__root = None
    self.__name = 
    self.__namespace = None
    self.__include_header_files = []
    self.__includes = []
    self.__include_enum_files = []
    self.__include_array_files = []
    self.__comment = 
    self.__members = []
    self.__type_id = None
    if (os.path.isfile(xml_file) == False):
        stri = ('ERROR: Could not find specified XML file %s.' % xml_file)
        raise OSError(stri)
    fd = open(xml_file)
    xml_file = os.path.basename(xml_file)
    self.__xml_filename = xml_file
    self.__config = ConfigManager.ConfigManager.getInstance()
    xml_parser = etree.XMLParser(remove_comments=True)
    element_tree = etree.parse(fd, parser=xml_parser)
    rng_file = self.__config.get('schema', element_tree.getroot().tag.lower()).lstrip('/')
    try:
        rng_file = locate_build_root(rng_file)
    except (BuildRootMissingException, BuildRootCollisionException) as bre:
        stri = 'ERROR: Could not find specified RNG file {}. {}'.format(rng_file, str(bre))
        raise OSError(stri)
    file_handler = open(rng_file)
    relax_parsed = etree.parse(file_handler)
    file_handler.close()
    relax_compiled = etree.RelaxNG(relax_parsed)
    if (not relax_compiled.validate(element_tree)):
        msg = 'XML file {} is not valid according to schema {}.'.format(xml_file, rng_file)
        raise FprimeXmlException(msg)
    serializable = element_tree.getroot()
    if (serializable.tag != 'serializable'):
        PRINT.info(('%s is not a serializable definition file' % xml_file))
        sys.exit((- 1))
    print(('Parsing Serializable %s' % serializable.attrib['name']))
    self.__name = serializable.attrib['name']
    if ('namespace' in serializable.attrib):
        self.__namespace = serializable.attrib['namespace']
    else:
        self.__namespace = None
    if ('typeid' in serializable.attrib):
        self.__type_id = serializable.attrib['typeid']
    else:
        self.__type_id = None
    for serializable_tag in serializable:
        if (serializable_tag.tag == 'comment'):
            self.__comment = serializable_tag.text.strip()
        elif (serializable_tag.tag == 'include_header'):
            self.__include_header_files.append(serializable_tag.text)
        elif (serializable_tag.tag == 'import_serializable_type'):
            self.__includes.append(serializable_tag.text)
        elif (serializable_tag.tag == 'import_enum_type'):
            self.__include_enum_files.append(serializable_tag.text)
        elif (serializable_tag.tag == 'import_array_type'):
            self.__include_array_files.append(serializable_tag.text)
        elif (serializable_tag.tag == 'members'):
            for member in serializable_tag:
                if (member.tag != 'member'):
                    PRINT.info(('%s: Invalid tag %s in serializable member definition' % (xml_file, member.tag)))
                    sys.exit((- 1))
                n = member.attrib['name']
                t = member.attrib['type']
                if ('size' in list(member.attrib.keys())):
                    if (t == 'ENUM'):
                        PRINT.info(('%s: Member %s: arrays of enums not supported yet!' % (xml_file, n)))
                        sys.exit((- 1))
                    s = member.attrib['size']
                    if (not s.isdigit()):
                        PRINT.info('{}: Member {}: size must be a number'.format(xml_file, n))
                        sys.exit((- 1))
                else:
                    s = None
                if ('format' in list(member.attrib.keys())):
                    f = member.attrib['format']
                elif (t in list(format_dictionary.keys())):
                    f = format_dictionary[t]
                else:
                    f = '%s'
                if (t == 'string'):
                    if (s is None):
                        PRINT.info(('%s: member %s string must specify size tag' % (xml_file, member.tag)))
                        sys.exit((- 1))
                if ('comment' in list(member.attrib.keys())):
                    c = member.attrib['comment']
                else:
                    c = None
                for member_tag in member:
                    if ((member_tag.tag == 'enum') and (t == 'ENUM')):
                        en = member_tag.attrib['name']
                        enum_members = []
                        for mem in member_tag:
                            mn = mem.attrib['name']
                            if ('value' in list(mem.attrib.keys())):
                                v = mem.attrib['value']
                            else:
                                v = None
                            if ('comment' in list(mem.attrib.keys())):
                                mc = mem.attrib['comment'].strip()
                            else:
                                mc = None
                            enum_members.append((mn, v, mc))
                        t = ((t, en), enum_members)
                    else:
                        PRINT.info(('%s: Invalid member tag %s in serializable member %s' % (xml_file, member_tag.tag, n)))
                        sys.exit((- 1))
                self.__members.append((n, t, s, f, c))
    if (not ('typeid' in serializable.attrib)):
        s = etree.tostring(element_tree.getroot())
        h = hashlib.sha256(s)
        n = h.hexdigest()
        self.__type_id = ('0x' + n.upper()[(- 8):])