-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprf_tools.py
44 lines (30 loc) · 938 Bytes
/
prf_tools.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import json
import xmltodict
class ListCheck:
def __init__(self):
pass
def get_added_list(self, new_list, old_list):
return set(new_list) - set(old_list)
class Validation:
def __init__(self):
pass
def check_none(self, content):
return content if content != ' ' and content != '' else None
class ParseToJson:
def __init__(self):
pass
def xml_to_json(self, xml_str):
if (Validation().check_none(xml_str) == None):
return None
if (Validation().check_none(xml_str) == 'None'):
return None
return json.dumps(xmltodict.parse(xml_str), indent=4, ensure_ascii=False)
class ParseToList:
def __init__(self):
pass
def xml_to_list(self, xml_str):
return list(map(lambda x: x.string, xml_str))
# class ParseToTable:
# def __init__(self):
# pass
# def prepareSession(self, dtguidance):