Esempio n. 1
0
def parse_resource_map_from_str(resource_map_xml):
    resource_map = d1_common.resource_map.ResourceMap()
    try:
        resource_map.deserialize(data=resource_map_xml, format='xml')
    except xml.sax.SAXException as e:
        raise d1_common.types.exceptions.InvalidRequest(
            0, u'Invalid Resource Map. error="{}"'.format(str(e)))
    return resource_map
Esempio n. 2
0
def parse_resource_map_from_str(resource_map_xml):
    resource_map = d1_common.resource_map.ResourceMap()
    try:
        resource_map.deserialize(data=resource_map_xml, format="xml")
    except xml.sax.SAXException as e:
        raise d1_common.types.exceptions.InvalidRequest(
            0, 'Invalid Resource Map. error="{}"'.format(str(e))
        )
    return resource_map
Esempio n. 3
0
def _parse_resource_map_from_file(resource_map_path):
    resource_map = d1_common.resource_map.ResourceMap()
    try:
        with open(resource_map_path, 'rb') as f:
            resource_map.deserialize(file=f, format='xml')
    except xml.sax.SAXException as e:
        raise d1_common.types.exceptions.InvalidRequest(
            0, u'Invalid Resource Map. error="{}"'.format(str(e)))
    return resource_map
Esempio n. 4
0
def _parse_resource_map_from_file(resource_map_path):
    resource_map = d1_common.resource_map.ResourceMap()
    try:
        with open(resource_map_path, "rb") as f:
            resource_map.deserialize(file=f, format="xml")
    except xml.sax.SAXException as e:
        raise d1_common.types.exceptions.InvalidRequest(
            0, 'Invalid Resource Map. error="{}"'.format(str(e))
        )
    return resource_map